Jump to content

GUI Buttom like checkbox


MyEarth
 Share

Go to solution Solved by MyEarth,

Recommended Posts

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
Link to comment
Share on other sites

  • Solution

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...