Jump to content

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

Note the use of BitAND :

#include <GUIConstants.au3>

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

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")
        Else
            GUICtrlSetData($checkbox, "unchecked")
        EndIf
    EndIf   
Wend

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.

Link to comment
Share on other sites

Works Perfectly thanks alot!

[Edit]

o i did see ur post when i posted Helge.. idk danny35d's way worked.. i think i may have messed something else up also tho n fixed that on accident :whistle:

Edited by lopolop
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...