Evil_Has_Survived Posted April 9, 2006 Share Posted April 9, 2006 how do I set a event for a botton, in a GUI box example #include <GUIConstants.au3> GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered Opt("GUICoordMode",2) GUICtrlCreateButton ("OK", 10, 30, 50) GUICtrlCreateButton ( "Cancel", 0, -1) EndIf clicked send("{EXIT}") something like that please I am trying to mess with this #include <GUIConstants.au3> GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered Opt("GUICoordMode",2) GUICtrlCreateButton ("OK", 10, 30, 50) GUICtrlCreateButton ( "Cancel", 0, -1) GUISetState () ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend it might help me Thanks in advance Link to comment Share on other sites More sharing options...
Valuater Posted April 9, 2006 Share Posted April 9, 2006 (edited) there is no GUIGetMsg() used with on event #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) GUICreate("MY GUI",220,200, 100,200) GUISetBkColor (0x00E0FFFF); will change background color GUISetOnEvent($GUI_EVENT_CLOSE, "Leave"); to handle click on button $button = GUICtrlCreateButton ("event",75,170,70,20) GUICtrlSetOnEvent(-1, "onclick"); to handle click on button GUISetState() While 1 Sleep (100) Wend Exit Func onclick() MsgBox(64,"event", "this was triggered by an event") ;do stuff EndFunc Func Leave() ; special action before exiting Exit EndFunc 8) Edited April 9, 2006 by Valuater 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