Sign in to follow this  
Followers 0
LibiO

On my on GUI:by pushing the button - close the GUI

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by JamesBrooks

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0