Sign in to follow this  
Followers 0
Rhyono

GUI Button states

4 posts in this topic

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



#2 ·  Posted (edited)

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
;or
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

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

#include <GUIConstantsEx.au3>

Example()

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
WEnd
EndFunc ;==>Example
Edited by MKISH
1 person likes this

----------------------------------------

: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

Check the helpfile for _GUICtrlButton_SetState. The example script should point you in the right direction.


√-1 2^3 ∑ π, and it was delicious!

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