NSearch Posted March 1, 2006 Posted March 1, 2006 I have two check boxes, I would like to be able to select only one. When one is selected, I would like the other to unselect. Would someone please help. Thanks.
MadBoy Posted March 1, 2006 Posted March 1, 2006 I have two check boxes, I would like to be able to select only one. When one is selected, I would like the other to unselect. Would someone please help. Thanks. Lets say you've got checkbox[1] as your first checkbox and checkbox[2] as your second checkbox. Now you have to do While 2 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $checkbox[1] GUICtrlSetState($checkbox[2],$GUI_UNCHECK) Case $msg = $checkbox[2] GUICtrlSetState($checkbox[1],$GUI_UNCHECK) EndSelect WEnd Think that would work My little company: Evotec (PL version: Evotec)
GaryFrost Posted March 1, 2006 Posted March 1, 2006 #include <guiconstants.au3> $m = GUICreate('test') $nonms = GUICtrlCreateCheckbox('test checkbox', 10, 10, 120) $nonms2 = GUICtrlCreateCheckbox('test checkbox 2', 10, 30, 120) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $nonms If BitAND(GUICtrlRead($nonms), $GUI_CHECKED) Then GUICtrlSetState($nonms2,$GUI_UNCHECKED) Case $msg = $nonms2 If BitAND(GUICtrlRead($nonms2), $GUI_CHECKED) Then GUICtrlSetState($nonms,$GUI_UNCHECKED) EndSelect WEnd SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
CyberSlug Posted March 1, 2006 Posted March 1, 2006 You should really use the radio control (to be consistent with standard user-interface design). Plus, you just need to replace GuiCtrlCreateCheckbox with GuiCtrlCreateRadio without adding additional code #include <GUIConstants.au3> GUICreate("Example") $radio1 = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20) GUICtrlSetState ($radio1, $GUI_CHECKED) $radio2 = GUICtrlCreateRadio ("Radio 2", 10, 40, 120, 20) GUISetState () While GuiGetMsg() <> $GUI_EVENT_CLOSE Wend Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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