Vladi243 Posted June 21, 2008 Share Posted June 21, 2008 How to uncheck automatically one checkbox while the other checked? I searched in the forum and the help file, and haven't found an answer. Link to comment Share on other sites More sharing options...
monoceres Posted June 21, 2008 Share Posted June 21, 2008 Like this maybe: #include <GUIConstantsEx.au3> Opt("GuiOnEventMode", 1) GUICreate("Checkboxes") GUISetOnEvent($GUI_EVENT_CLOSE, "close") $cb1 = GUICtrlCreateCheckbox("Check me!", 10, 10) GUICtrlSetOnEvent(-1, "_Checked") $cb2 = GUICtrlCreateCheckbox("Checkers!", 10, 50) GUISetState() Do Sleep(10) Until False Func close() Exit EndFunc ;==>close Func _Checked() If BitAND(GUICtrlRead($cb1), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($cb2, $GUI_UNCHECKED) Else GUICtrlSetState($cb2, $GUI_CHECKED) EndIf EndFunc ;==>_Checked Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Vladi243 Posted June 21, 2008 Author Share Posted June 21, 2008 I've already thought about it by self, but it's not working. Any other idea? Link to comment Share on other sites More sharing options...
Cater Posted June 21, 2008 Share Posted June 21, 2008 (edited) #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 153, 191, 193, 125) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 32, 24, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 32, 80, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 32, 128, 97, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If GUICtrlRead($checkbox2) = 1 And GUICtrlRead($checkbox3) = 1 Then GUICtrlSetState($checkbox1, $GUI_UNCHECKED) EndIf WEnd Always when $checkbox2 and $checkbox3 are checked $checkbox1 are unchecked. Edited June 21, 2008 by Cater Link to comment Share on other sites More sharing options...
monoceres Posted June 21, 2008 Share Posted June 21, 2008 I've already thought about it by self, but it's not working.Any other idea?Uhm, I think my example works very well.If you need both boxes working just add the event for the other one as well. 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