Jump to content

Newbee - Read from Input and Calculate


Recommended Posts

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!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...