Jump to content

Recommended Posts

Posted

I am struggling with how to make a button APPEAR to be toggled. That is, when clicked once it will appear to be "pressed" or selected in some way, and when click again it will appear to be unpressed. This would be similar in function to the bold button on a word processor toolbar - it would stay "pressed" until clicked again.

I am OK with the code behind the the states/actions. It is more the visuals that I am looking for

Thanks all in advance.

Posted

This?

#include <GuiConstants.au3>

$hGui = GUICreate("Test to toggle", 200, 100)

$button = GUICtrlCreateCheckbox("Toggle", 10, 70, 50, 25, $BS_PUSHLIKE)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        ExitLoop
    Case $button
        Switch GUICtrlRead($button)
        Case $GUI_CHECKED
            ConsoleWrite("Button pressed" & @CRLF)
        Case $GUI_UNCHECKED
            ConsoleWrite("Button unpressed" & @CRLF)
        EndSwitch
        
    EndSwitch
WEnd

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
  • Recently Browsing   0 members

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