Jump to content
Sign in to follow this  
MyEarth

GUI Buttom like checkbox

Recommended Posts

MyEarth

Hello,

I have searched aroud but i don't have find nothing about this:

I want to make a button work like a checkbox, in this way:

- With one click the button change the state from unpressed to pressed and remain pressed

- The opposite, if state is pressed make it unpressed

Thank you

Edited by MyEarth

Share this post


Link to post
Share on other sites
MyEarth

I have serched for button the is a style of a checkbox:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>

$Form = GUICreate("Form", 247, 233, -1, -1)
$Button = GUICtrlCreateCheckbox("I'm a button", 72, 56, 97, 33, $BS_PUSHLIKE)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            If GUICtrlRead($Button) = $GUI_CHECKED Then ConsoleWrite("PRESSED" & @CRLF)
            If GUICtrlRead($Button) = $GUI_UNCHECKED Then ConsoleWrite("UNPRESSED"& @CRLF)
    EndSwitch
WEnd
Edited by MyEarth

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  

×