Champak Posted May 8, 2006 Share Posted May 8, 2006 How can I make checkbox "B" readonly if checkbox "A" is checked and release, and the vice versa. This is wht I have, but it doesn't work. If GUICtrlRead($removeMD) = $GUI_CHECKED then GUICtrlSetStyle($exportmaster, $WS_DISABLED) EndIf If GUICtrlRead($removeMD) = $GUI_UNCHECKEDCHECKED then GUICtrlSetStyle($exportmaster, $GUI_ENABLE) EndIf If GUICtrlRead($exportmaster) = $GUI_CHECKED then GUICtrlSetStyle($removeMD, $WS_DISABLED) EndIf If GUICtrlRead($removeMD) = $GUI_UNCHECKEDCHECKED then GUICtrlSetStyle($removeMD, $GUI_ENABLE) EndIf Link to comment Share on other sites More sharing options...
Valuater Posted May 8, 2006 Share Posted May 8, 2006 (edited) if you use radios instead of check boxes, they will automatically do this within a group just noted ... change GUICtrlSetStyle to GUICtrlSetState 8) Edited May 8, 2006 by Valuater Link to comment Share on other sites More sharing options...
Champak Posted May 8, 2006 Author Share Posted May 8, 2006 Yes, I thought of that. However, it is a part of a larger set of inputs that are all checkboxes. Two radios out of several checkboxes are not very aesthetically pleasing. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 8, 2006 Moderators Share Posted May 8, 2006 (edited) Yes, I thought of that. However, it is a part of a larger set of inputs that are all checkboxes. Two radios out of several checkboxes are not very aesthetically pleasing.Edit: Bad Example, I'll see if I can come up with something else Edit2: You could set it up something like this I guess:expandcollapse popup#include <guiconstants.au3> Global $DisableBox = 0 Local $CheckBox[3] $Main = GUICreate('Test Checkbox', 200, 100) $CheckBox[1] = GUICtrlCreateCheckbox('Box 1', 10, 10, 50, 20) $CheckBox[2] = GUICtrlCreateCheckbox('Box 2', 10, 35, 50, 20) GUISetState() While 1 $Msg = GUIGetMsg() Select Case $Msg = - 3 Exit Case $Msg = $CheckBox[1] If Not $DisableBox Then _CheckBoxDisable() ElseIf $DisableBox Then If BitAND(GUICtrlRead($CheckBox[2]), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($CheckBox[1], $GUI_UNCHECKED) _CheckBoxDisable() EndIf EndIf Case $Msg = $CheckBox[2] If Not $DisableBox Then _CheckBoxDisable() ElseIf $DisableBox Then If BitAND(GUICtrlRead($CheckBox[1]), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($CheckBox[2], $GUI_UNCHECKED) _CheckBoxDisable() EndIf EndIf EndSelect WEnd Func _CheckBoxDisable() $DisableBox = Not $DisableBox EndFunc Edit3: Or just do what Simucal said, that example looks much easier (Damn I over think things so often ) Edited May 8, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Simucal Posted May 8, 2006 Share Posted May 8, 2006 (edited) Search for "checkbox" returned this result on the first page:http://www.autoitscript.com/forum/index.ph...386&hl=checkboxWhen one is checked, uncheck the otherEdit: Like Valuater said, you are using GuiCtrlSetStyle, not SetState. Edited May 8, 2006 by Simucal AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
Champak Posted May 8, 2006 Author Share Posted May 8, 2006 (edited) Thanks both of you. I used Simucal's link, it was much simpler. I did do a search, but I used "readonly +checkbox" because I figured "checkbox" would return way too many pages. SmOke_N, with your code if you Check "A", then go to check "B" once, it works. However, if you try and check "B" a second time, it goes through. Thanks anyway. I didn't even notice what Valuater said there, I just saw radio. Edited May 8, 2006 by Champak 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