sroprogger Posted April 9, 2008 Share Posted April 9, 2008 Hi How can I check if a checkbox is checked or not. I tried If $check = $GUI_CHECKED Then MsgBox(0,"","checked") but it wont work and i think its false ! so pls help me Link to comment Share on other sites More sharing options...
Paulie Posted April 9, 2008 Share Posted April 9, 2008 If GuiCtrlRead($Check) = $GUI_CHECKED then Msgbox(0,"","Checked!") Else Msgbox(0,"","Not Checked!") EndIf Link to comment Share on other sites More sharing options...
Swift Posted April 9, 2008 Share Posted April 9, 2008 You must use GUICtrlRead() If it's a GUI Control! Link to comment Share on other sites More sharing options...
Squirrely1 Posted April 9, 2008 Share Posted April 9, 2008 I heard that using BitAND is more reliable for this: $CBox = GUICtrlCreateCheckbox("My checkbox", 11, 11) If BitAND(GuiCtrlRead($CBox), $GUI_CHECKED) = $GUI_CHECKED Then ;If GuiCtrlRead($CBox) = $GUI_CHECKED Then Msgbox(0,"","$CBox is Checked!") Else Msgbox(0,"","$CBox is Not Checked!") EndIf Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Valuater Posted April 9, 2008 Share Posted April 9, 2008 (edited) First, Squirrely1 is correct Secondly... Generally, there is more that one checkbox or radio to be check and many use an array to create/check these controls, so I use this.... ( from Zedna in Autoit Wrappers ) Func _IsChecked($control) Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED EndFunc example If _IsChecked($control_name) then.... 8) Edited April 9, 2008 by Valuater Link to comment Share on other sites More sharing options...
Swift Posted April 9, 2008 Share Posted April 9, 2008 I've never had any problems with: If GUICtrlRead($Control) = $GUI_CHECKED Then Link to comment Share on other sites More sharing options...
monoceres Posted April 9, 2008 Share Posted April 9, 2008 I've never had any problems with: If GUICtrlRead($Control) = $GUI_CHECKED ThenTry use GUICtrlSetState($Control,$GUI_DISABLE) and then use your method Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now