LibiO Posted January 3, 2010 Share Posted January 3, 2010 I create my own GUI with push button. And I need, when someone, physically, is pushing this button = > my GUI closes. (Exactly like, OK button on the MsgBox(0, "info", "OK"). $hGUI = GUICreate("Selective suspend", 800, 800) $btn = _GUICtrlButton_Create($hGUI, "selective suspend : " & $selective_suspend & " please touch the screen with " & $numOfFingers &" fingers" & " and then immediately click the OK with the mouse", 50, 50, 700, 700, $BS_PUSHLIKE) GUISetState() Then, when button is pushed - my GUI closes Thanks Link to comment Share on other sites More sharing options...
James Posted January 3, 2010 Share Posted January 3, 2010 (edited) $hGUI = GUICreate("Selective suspend", 800, 800) $btn = _GUICtrlButton_Create($hGUI, "selective suspend : " & $selective_suspend & " please touch the screen with " & $numOfFingers &" fingers" & " and then immediately click the OK with the mouse", 50, 50, 700, 700, $BS_PUSHLIKE) GUISetState() Then, when button is pushed - my GUI closes Well you're going about it the wrong way. You should be using the native GUICtrlCreateButton functions. #include <GUIConstantsEx.au3> $GUI = GUICreate("Form1", 146, 81, 192, 124) $btnClickMe = GUICtrlCreateButton("Click me!", 8, 8, 129, 65) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ; You can also add ", $btnClickMe" to chain them together Exit Case $btnClickMe MsgBox(0, "Me!", "I'm going to close now. Bye!") Exit EndSwitch WEnd Edited January 3, 2010 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
LibiO Posted January 3, 2010 Author Share Posted January 3, 2010 Perfect!!!!! Thank you! Well you're going about it the wrong way. You should be using the native GUICtrlCreateButton functions. #include <GUIConstantsEx.au3> $GUI = GUICreate("Form1", 146, 81, 192, 124) $btnClickMe = GUICtrlCreateButton("Click me!", 8, 8, 129, 65) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ; You can also add ", $btnClickMe" to chain them together Exit Case $btnClickMe MsgBox(0, "Me!", "I'm going to close now. Bye!") Exit EndSwitch WEnd 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