au3scr Posted November 14, 2007 Share Posted November 14, 2007 How i do on change action?I tryied something like this but it didnt work.Can some one say how i should do it?Case $Input1 Exit Link to comment Share on other sites More sharing options...
stampy Posted November 14, 2007 Share Posted November 14, 2007 I believe your asking about preforming an action from a gui. In the help file search for gui concepts. It will list message loop mode and Onevent mode. As follows. The help file has many more details. message loop: expandcollapse popup#include <GUIConstants.au3> $mainwindow = GUICreate("Hello World", 200, 100) GUICtrlCreateLabel("Hello world! How are you?", 30, 10) $okbutton = GUICtrlCreateButton("OK", 70, 50, 60) $dummywindow = GUICreate("Dummy window for testing ", 200, 100) GUISwitch($mainwindow) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $okbutton MsgBox(0, "GUI Event", "You pressed OK!") Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $mainwindow MsgBox(0, "GUI Event", "You clicked CLOSE on the main window! Exiting...") ExitLoop EndSelect WEndoÝ÷ ÚÞ½éíjëh×6#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("Hello World", 200, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUICtrlCreateLabel("Hello world! How are you?", 30, 10) $okbutton = GUICtrlCreateButton("OK", 70, 50, 60) GUICtrlSetOnEvent($okbutton, "OKButton") GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd Func OKButton() ;Note: at this point @GUI_CTRLID would equal $okbutton, ;and @GUI_WINHANDLE would equal $mainwindow MsgBox(0, "GUI Event", "You pressed OK!") EndFunc Func CLOSEClicked() ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, ;and @GUI_WINHANDLE would equal $mainwindow MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...") Exit EndFunc 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