Jump to content
Sign in to follow this  

GUI Button states

Recommended Posts

I would like to be able to make it so that when a button is pressed, it remains in the "down" state until it is clicked again. Then be able to do a boolean check if the button is down. Is this a possibility with AutoIt or am I going to have to use checkboxes?

Share this post

Link to post
Share on other sites

You could crop some screenshots of the button in different states.

Then use this:

$button= guictrlcreatebutton("", 188, 5, 146, 27, $bs_bitmap);create button with $bs_bitmap flag
;then change the graphic with
guictrlsetimage($button, @scriptdir&"graphicsbuttonpressed.bmp");your button pressed graphic
guictrlsetimage($button, @scriptdir&"graphicsbutton.bmp");your button graphic before pressed

Of course you would have to choose some graphics and directory structure for yourself.

Edited by Xandy

Share this post

Link to post
Share on other sites

Checkbox is a better option, but you can make it look like a button:

#include <GUIConstantsEx.au3>


Func Example()
Local $msg
GUICreate("My Example") ; will create a dialog box that when displayed is centered

GUICtrlCreateCheckbox("My Button", 10, 10, 120, 20, 0x1000)

GUISetState() ; will display an dialog box with 1 checkbox

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop
EndFunc ;==>Example
Edited by MKISH


:bye: Hey there, was I helpful?


My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...