Newb Posted June 9, 2015 Share Posted June 9, 2015 (edited) Tried to run this but nothing happens when I click the button. I'm a bit rusty on GuiOnEventMode but I fiddled around a bit and didn't managed it to work. I wrote a 300 lines program with GuiGetMsg() and i hand't any problems but I can't figure out this. I tried also to stick to the example on the help guide (which encloses all the gui creation code in a function called Test() and runs it and so I did) but without success What I'm doing wrong? expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) GUICreate("Form1", 184, 97, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") $Button1 = GUICtrlCreateButton("HEY CLICK ME", 28, 23, 124, 49) GUISetOnEvent(-1, "MyFunction") GUISetState(@SW_SHOW) Global $Iamrunning = False While 1 Sleep(10) WEnd Func MyFunction() MsgBox(0, "A", "A") If Not $Iamrunning Then MsgBox(0, "A", "B") $Iamrunning = True GUICtrlSetData($Button1, "I'm busy!") Sleep(10000) GUICtrlSetData($Button1, "HEY CLICK ME") $Iamrunning = False Else Return EndIf EndFunc ;==>MyFunction Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit EndSelect EndFunc ;==>SpecialEvents Edited June 9, 2015 by Newb I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it. Link to comment Share on other sites More sharing options...
mikell Posted June 9, 2015 Share Posted June 9, 2015 GUICtrlSetOnEvent(-1, "MyFunction") Newb 1 Link to comment Share on other sites More sharing options...
Newb Posted June 9, 2015 Author Share Posted June 9, 2015 (edited) OK that's embarassing. Should have looked it not twice but thousand times. Thanks Edited June 9, 2015 by Newb I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now