Ticket #3729: AutoIt - GuiCtrlSetDefXXColor double event bug.au3

File AutoIt - GuiCtrlSetDefXXColor double event bug.au3, 1.5 KB (added by Enrico Boldori <mainmaster@…>, 3 months ago)

Reproduction script for the reported issue

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