| 1 | #include <GUIConstantsEx.au3>
|
|---|
| 2 |
|
|---|
| 3 | #include <Debug.au3>
|
|---|
| 4 | _DebugSetup("Scribe debuger", True)
|
|---|
| 5 |
|
|---|
| 6 | Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
|
|---|
| 7 | $mainwindow = GUICreate("Hello World", 200, 100)
|
|---|
| 8 | GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
|
|---|
| 9 | GUICtrlCreateLabel("Hello world! How are you?", 30, 10)
|
|---|
| 10 | $okbutton = GUICtrlCreateButton("OK", 70, 50, 60)
|
|---|
| 11 | GUICtrlSetOnEvent($okbutton, "OKButton")
|
|---|
| 12 | GUISetState(@SW_SHOW)
|
|---|
| 13 |
|
|---|
| 14 | While 1
|
|---|
| 15 | Sleep(1000) ; Idle around
|
|---|
| 16 | WEnd
|
|---|
| 17 |
|
|---|
| 18 | Func OKButton()
|
|---|
| 19 | ;Note: at this point @GUI_CTRLID would equal $okbutton,
|
|---|
| 20 | ;and @GUI_WINHANDLE would equal $mainwindow
|
|---|
| 21 | MsgBox(0, "GUI Event", "You pressed OK!")
|
|---|
| 22 | EndFunc
|
|---|
| 23 |
|
|---|
| 24 | Func CLOSEClicked()
|
|---|
| 25 | ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
|
|---|
| 26 | ;and @GUI_WINHANDLE would equal $mainwindow
|
|---|
| 27 | MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
|
|---|
| 28 | Exit
|
|---|
| 29 | EndFunc
|
|---|