Jump to content
Sign in to follow this  

Check if Disabled?

Recommended Posts

im having some trouble but i have a input box that i have an If Statment to check if it's Enabled but it isnt working...

I also need to check if it is Disabled.

If GUICtrlGetState($Input) = "$GUI_ENABLE" Then
    GUICtrlSetState($Input, $GUI_DISABLE)
The problem is the input state is actually enable and show so try this

If GUICtrlGetState($Input) = $GUI_ENABLE + $GUI_SHOW then

and to check if is disable try

If GUICtrlGetState($Input) = $GUI_DISABLE + $GUI_SHOW then

Edit: Typo

Edited by Danny35d

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post

Link to post
Share on other sites

Note the use of BitAND :

#include <GUIConstants.au3>

GUICreate("", 100, 40)
$checkbox = GUICtrlCreateCheckbox ("unchecked", 10, 10, 180, 20)

While 1
    $iMsg = GUIGetMsg()
    If $iMsg = $GUI_EVENT_CLOSE Then ExitLoop
    If $iMsg = $checkbox Then
        If BitAND(GUICtrlRead($checkbox), $GUI_CHECKED) Then
            GUICtrlSetData($checkbox, "checked")
            GUICtrlSetData($checkbox, "unchecked")

Btw, on your first line you're trying to compare the value returned by GUICtrlGetState

with a string. Not very important in your example anyway since your method wouldn't

have worked anyway, but keep that in mind to next time.

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  

  • Create New...