1 | #include <GUIConstants.au3> |
---|
2 | #include <GUIConstantsEx.au3> |
---|
3 | #include <WindowsConstants.au3> |
---|
4 | |
---|
5 | Opt("GUIOnEventMode", 1) ; 1 = enable |
---|
6 | Opt("GUIEventOptions", 0) ; 0 = (default) Windows behavior on click on Minimize,Restore, Maximize, Resize. |
---|
7 | |
---|
8 | $hGui = GUICreate("Test double event") |
---|
9 | GUISetBkColor(0xABCDEF, $hGui) |
---|
10 | |
---|
11 | ; -------------------------------------------------- |
---|
12 | ; Calling any of these will create the issue |
---|
13 | ; -------------------------------------------------- |
---|
14 | GUICtrlSetDefColor(0x222222) |
---|
15 | GUICtrlSetDefbKColor(0x9ABCDE) |
---|
16 | |
---|
17 | GUISetOnEvent($GUI_EVENT_CLOSE, "guiEventsHandler", $hGui) |
---|
18 | GUISetOnEvent($GUI_EVENT_RESTORE, "guiEventsHandler", $hGui) |
---|
19 | GUISetOnEvent($GUI_EVENT_MINIMIZE, "guiEventsHandler", $hGui) |
---|
20 | |
---|
21 | $testButton = GuiCtrlCreateButton("Test input", 8, 8, 100) |
---|
22 | GUICtrlSetOnEvent($testButton, buttonHandler) |
---|
23 | |
---|
24 | $testInput = GuiCtrlCreateInput("asdasd", 8, 48, 100) |
---|
25 | GUICtrlSetOnEvent($testInput, inputHandler) |
---|
26 | |
---|
27 | GUISetState() |
---|
28 | |
---|
29 | While 1 |
---|
30 | Sleep(10) |
---|
31 | WEnd |
---|
32 | |
---|
33 | Func guiEventsHandler() |
---|
34 | If @GUI_CtrlId == $GUI_EVENT_CLOSE Then Exit |
---|
35 | If @GUI_CtrlId == $GUI_EVENT_RESTORE Then GUISetState(@SW_RESTORE, @GUI_WinHandle) |
---|
36 | If @GUI_CtrlId == $GUI_EVENT_MAXIMIZE Then GUISetState(@SW_MAXIMIZE, @GUI_WinHandle) |
---|
37 | If @GUI_CtrlId == $GUI_EVENT_MINIMIZE Then GUISetState(@SW_MINIMIZE, @GUI_WinHandle) |
---|
38 | EndFunc |
---|
39 | |
---|
40 | Func buttonHandler() |
---|
41 | MsgBox(0, "Button handler", "Got an event from the button") |
---|
42 | EndFunc |
---|
43 | |
---|
44 | Func inputHandler() |
---|
45 | MsgBox(0, "Input handler", "Got an event from the input") |
---|
46 | EndFunc |
---|