SumTingWong Posted October 7, 2004 Share Posted October 7, 2004 (edited) Hi, I tried GUICtrlGetState to see if a checkbox is enabled or disabled and it returns 0 instead of a valid control state id. Doing the same thing on a button correctly returns 128 or $GUI_DISABLE. As I understand it, GUIRead can be used to check for $GUI_CHECKED/$GUI_UNCHECKED and GUICtrlGetState to check for $GUI_ENABLE/$GUI_DISABLE for checkboxes and radio controls. Thanks Edited October 7, 2004 by pacman Link to comment Share on other sites More sharing options...
jpm Posted October 8, 2004 Share Posted October 8, 2004 Hi,I tried GUICtrlGetState to see if a checkbox is enabled or disabled and it returns 0 instead of a valid control state id. Doing the same thing on a button correctly returns 128 or $GUI_DISABLE.As I understand it, GUIRead can be used to check for $GUI_CHECKED/$GUI_UNCHECKED and GUICtrlGetState to check for $GUI_ENABLE/$GUI_DISABLE for checkboxes and radio controls.Thanks<{POST_SNAPBACK}>under the current beta is working perfect.Can you put a sample of your script showing the problem? Link to comment Share on other sites More sharing options...
SumTingWong Posted October 8, 2004 Author Share Posted October 8, 2004 I just tested it again using a sample script and both GUIRead and GUICtrlGetState worked as expected. Back to debugging my original script Thanks for your help. Link to comment Share on other sites More sharing options...
SumTingWong Posted October 8, 2004 Author Share Posted October 8, 2004 (edited) OK, here's some sample code to illustrate the problem I am having: AutoItSetOption("GUICoordMode", 1) AutoItSetOption("GUIResizeMode", 1) #include <GUIConstants.au3> GUICreate("Test", 400, 300, -1, -1) $chkTest1 = GUICtrlCreateCheckbox(" Test 1", 85, 60, 370, 15) GUICtrlSetState(-1, $GUI_CHECKED) $chkTest2 = GUICtrlCreateCheckbox(" Test 2", 85, 100, 370, 15) GUICtrlSetState(-1, $GUI_DISABLE) $chkTest3 = GUICtrlCreateCheckbox(" Test 3", 85, 140, 370, 15) GUICtrlSetState(-1, $GUI_HIDE) $btnTest = GUICtrlCreateButton("Test", 85, 180, 70, 30) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $btnTest GUICtrlSetState($chkTest3, $GUI_SHOW) MsgBox(4096, "", "Test1 control state = " & GUICtrlGetState($chkTest1) & @CRLF & _ "Test2 control state = " & GUICtrlGetState($chkTest2) & @CRLF & _ "Test3 control state = " & GUICtrlGetState($chkTest3)) EndSelect Wend GUIDelete() Clicking on Test sets the state of $chkTest3 to $GUI_SHOW to make it visible Test1 control state = 80 ($GUI_SHOW+$GUI_ENABLE) Test2 control state = 128 ($GUI_DISABLE) - should it be ($GUI_SHOW+$GUI_DISABLE)? Test3 control state = 16 ($GUI_SHOW) - should it be ($GUI_SHOW+$GUI_ENABLE)? I am using the latest unstable released by Jon yesterday. Thanks Edited October 8, 2004 by pacman Link to comment Share on other sites More sharing options...
jpm Posted October 8, 2004 Share Posted October 8, 2004 OK, here's some sample code to illustrate the problem I am having:Clicking on Test sets the state of $chkTest3 to $GUI_SHOW to make it visibleTest1 control state = 80 ($GUI_SHOW+$GUI_ENABLE)Test2 control state = 128 ($GUI_DISABLE) - should it be ($GUI_SHOW+$GUI_DISABLE)?Test3 control state = 16 ($GUI_SHOW) - should it be ($GUI_SHOW+$GUI_ENABLE)?I am using the latest unstable released by Jon yesterday.Thanks<{POST_SNAPBACK}>I see you are wondering changing the state from hide to show does not give back the $gui_show+$gui_enable. the answer is hide is not managing the enable/disable state, you never set the enable/disable state for this checkbox so you cannot get the enable/disable state.It is true the state is enable because we see the button.I don't know if we will change to report a state visible which have not been set.for the time being just check is disable and assume if not it is enabled;Sorry for the trouble Link to comment Share on other sites More sharing options...
SumTingWong Posted October 8, 2004 Author Share Posted October 8, 2004 No problem.... I am now using ControlCommand function with the "IsEnabled" option. Thanks for checking 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