Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Newbee - Read from Input and Calculate


  • Please log in to reply
3 replies to this topic

#1 tigerduck

tigerduck

    Seeker

  • Active Members
  • 5 posts

Posted 06 July 2010 - 02:29 PM

Hi there,

i just wanna create a easy gui. Well it's not that easy for me :blink:

I hava a gui, where i give some parameters (counters)

- hour
- minute
- date
- month
- year

foreach there is a inputbox.
Now i want to read the input and calculate the input then. The Result should be show as hours. the compare date is the actual timestamp.
for example Input is: 12:00 12.12.2010
actual timestamp should be 12:00 13.12.2010
So REsult should be 24hours...

this is my gui:

;Include constants
#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()

;Initialize variables
Local $GUIWidth = 200, $GUIHeight = 220
Local $Edit_Stunde, $Edit_Minute, $Edit_Tag, $Edit_Monat, $Edit_Jahr, $Calc_Btn, $Exit_Btn, $msg

;Create window
GUICreate("Geburtsrechner", $GUIWidth, $GUIHeight)

;Create an edit box with no text in it
$Edit_Stunde = GUICtrlCreateInput("Stunde eingeben", 10, 30, 180, 20)

;Create an edit box with no text in it
$Edit_Minute = GUICtrlCreateInput("Minute eingeben", 10, 60, 180, 20)

;Create an edit box with no text in it
$Edit_Tag = GUICtrlCreateInput("Tag eingeben", 10, 90, 180, 20)

;Create an edit box with no text in it
$Edit_Monat = GUICtrlCreateInput("Monat eingeben", 10, 120, 180, 20)

;Create an edit box with no text in it
$Edit_Jahr = GUICtrlCreateInput("Jahr eingeben", 10, 150, 180, 20)

;Create an "Berechne" button
$Calc_Btn = GUICtrlCreateButton("Berechnen", 20, 180, 70, 25)

;Create a "Exit" button
$Exit_Btn = GUICtrlCreateButton("Verlassen", 110, 180, 70, 25)

;Show window/Make the window visible
GUISetState(@SW_SHOW)

;Loop until:
;- user presses Esc
;- user presses Alt+F4
;- user clicks the close button
While 1
;After every loop check if the user clicked something in the GUI window
$msg = GUIGetMsg()

Select

;Check if user clicked on the close button
Case $msg = $GUI_EVENT_CLOSE
;Destroy the GUI including the controls
GUIDelete()
;Exit the script
Exit

;Check if user clicked on the "OK" button
Case $msg = $Calc_Btn

MsgBox(64, "Ergebnis:", "test")

;Check if user clicked on the "CANCEL" button
Case $msg = $Exit_Btn
Exit

EndSelect

WEnd
EndFunc ;==>_Main


thanks for any help!!







#2 somdcomputerguy

somdcomputerguy

  • Active Members
  • PipPipPipPipPipPip
  • 2,640 posts

Posted 06 July 2010 - 02:51 PM

Look at the _DateDiff function.

- Bruce /* somdcomputerguy */  If you change the way you look at things, the things you look at change.


#3 tigerduck

tigerduck

    Seeker

  • Active Members
  • 5 posts

Posted 09 July 2010 - 07:44 AM

rogger that.
thanks...

#4 somdcomputerguy

somdcomputerguy

  • Active Members
  • PipPipPipPipPipPip
  • 2,640 posts

Posted 09 July 2010 - 02:19 PM

You bet. Hope it helps. :blink:

- Bruce /* somdcomputerguy */  If you change the way you look at things, the things you look at change.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users