lyledg 0 Posted November 25, 2004 Guys.. Still learning heaps so apologies for the dumbass question.. I am trying to enable a input box, (which is intially set disabled) through a checkbox.. Basically, If a user chooses the checkbox, the input box should get enabled to accept text.. I know this is simple enough, just been coding all day and not seeing the answer right now... Cheers! Share this post Link to post Share on other sites
jpm 93 Posted November 25, 2004 Guys..Still learning heaps so apologies for the dumbass question..I am trying to enable a input box, (which is intially set disabled) through a checkbox..Basically, If a user chooses the checkbox, the input box should get enabled to accept text..I know this is simple enough, just been coding all day and not seeing the answer right now...Cheers! <{POST_SNAPBACK}>GUICtrlSetState($id,$GUI_ENABLE) Share this post Link to post Share on other sites
lyledg 0 Posted November 25, 2004 (edited) Thanks, i have already done this, but still not working..Here is my code this far:expandcollapse popupGlobal $LOGFILLOC = GUICtrlCreateInput ("", 30, 195 , 300, 20) GUICtrlSetState(-1,$GUI_ACCEPTFILES)GUICtrlSetState(-1,$GUI_DISABLE)$LOG = GUICtrlCreateCheckbox ("/LOG :: Output status to LOG file (overwrite existing log)", 25, 400, 300, 20)While 1 $msg = GUIGetMsg() If GUIRead($LOG) = $GUI_CHECKED Then GUICtrlSetState ($LOGFILLOC, $GUI_ENABLED) Else EndIf EndIf[code=auto:0]When using this, I get an error saying I have not defined $LOGFILLOC as a variable. But I have declared this as a Global variable already, what am I doing wrong?CheersSee attachment Edited November 25, 2004 by lyledg Share this post Link to post Share on other sites SlimShady 1 SlimShady 1 AutoIt lover Active Members 1 2,276 posts Posted November 25, 2004 (edited) This should work: #include <GUIConstants.au3> Global $LOGFILLOC = GUICtrlCreateInput ("", 30, 195 , 300, 20) GUICtrlSetState(-1,$GUI_ACCEPTFILES) GUICtrlSetState(-1,$GUI_DISABLE) $LOG = GUICtrlCreateCheckbox ("/LOG :: Output status to LOG file (overwrite existing log)", 25, 400, 300, 20) While 1 $msg = GUIGetMsg() If GUIRead($LOG) = $GUI_CHECKED Then GUICtrlSetState ($LOGFILLOC, $GUI_ENABLE) Else EndIf EndIf Edited November 25, 2004 by SlimShady Share this post Link to post Share on other sites
jpm 93 Posted November 25, 2004 Thanks, i have already done this, but still not working..Here is my code this far:expandcollapse popupGlobal $LOGFILLOC = GUICtrlCreateInput ("", 30, 195 , 300, 20) GUICtrlSetState(-1,$GUI_ACCEPTFILES)GUICtrlSetState(-1,$GUI_DISABLE)$LOG = GUICtrlCreateCheckbox ("/LOG :: Output status to LOG file (overwrite existing log)", 25, 400, 300, 20)While 1 $msg = GUIGetMsg() If GUIRead($LOG) = $GUI_CHECKED Then GUICtrlSetState ($LOGFILLOC, $GUI_ENABLED) Else EndIf EndIf[code=auto:0]When using this, I get an error saying I have not defined $LOGFILLOC as a variable. But I have declared this as a Global variable already, what am I doing wrong?CheersSee attachment[post="43275"]<{POST_SNAPBACK}>[/post]the error come from $GUI_ENABLED and not from $LOGFILLOCthe state variable is $GUI_ENABLE Share this post Link to post Share on other sites lyledg 0 lyledg 0 Universalist Active Members 0 287 posts Posted November 25, 2004 Mate So is the code I am using correct or not? I am a little confused by your answer.. Cheers Share this post Link to post Share on other sites MHz 80 MHz 80 Just simple MVPs 80 5,552 posts Posted November 25, 2004 I am a little confused by your answer..As SlimShady has done. He has inserted at the top of his rewrite of your script.#include <GUIConstants.au3>You need to have this in Gui scripts. It contains this$GUI_ENABLEThis was causing problems. And as jpm described with$GUI_ENABLEDshould be$GUI_ENABLEHope this clears your thoughts on your code.My advise. lose the else and the extra endif. And add Wend to close the While loop#include <GUIConstants.au3> Global $LOGFILLOC = GUICtrlCreateInput ("", 30, 195 , 300, 20) GUICtrlSetState(-1,$GUI_ACCEPTFILES) GUICtrlSetState(-1,$GUI_DISABLE) $LOG = GUICtrlCreateCheckbox ("/LOG :: Output status to LOG file (overwrite existing log)", 25, 400, 300, 20) While 1 $msg = GUIGetMsg() If GUIRead($LOG) = $GUI_CHECKED Then GUICtrlSetState ($LOGFILLOC, $GUI_ENABLE) EndIf WendGood luck. Share this post Link to post Share on other sites lyledg 0 Posted November 25, 2004 Thanks Guys!! I was too tired to see what JPM had actually meant... Thanks for the explanation! All working now.. Share this post Link to post Share on other sites 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 account Sign in Already have an account? Sign in here. Sign In Now Sign in to follow this Followers 0
lyledg 0 Posted November 25, 2004 Thanks Guys!! I was too tired to see what JPM had actually meant... Thanks for the explanation! All working now.. Share this post Link to post Share on other sites