Jump to content

GUI Button states


Rhyono
 Share

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?

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

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

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

:bye: Hey there, was I helpful?

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

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

Link to comment
Share on other sites

  • Moderators

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...