Sign in to follow this  
Followers 0
lopolop

Check if Disabled?

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

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