totaln00ber Posted March 6, 2007 Posted March 6, 2007 Hello experts, Trying to make an input field listener to see if there's any text type. If something is typed inside the input field, then a checkbox that's beside it should automatically be checked off. If the user presses backspace / clears the field, then the checkbox should uncheck itself. Here's what I have so far, but it doesn't seem to be working: ... $chkCus = GUICtrlCreateCheckbox("", 225, 139, 17, 17) $txtCus = GUICtrlCreateInput("", 245, 137, 82, 21) $gCusTxt = GUICtrlRead($txtCus) While 1 If $gCusTxt <> "" Then GUICtrlSetState($chkCus, $GUI_CHECKED) Else GUICtrlSetState($chkCus, $GUI_UNCHECKED) EndIf WEnd
xcal Posted March 6, 2007 Posted March 6, 2007 (edited) #include <GUIConstants.au3> GUICreate('') $checkbox = GUICtrlCreateCheckbox('some checkbox', 10, 10) $input = GUICtrlCreateInput('', 10, 40) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch If GUICtrlRead($input) <> '' Then GUICtrlSetState($checkbox, $GUI_CHECKED) Else GUICtrlSetState($checkbox, $GUI_UNCHECKED) EndIf WEnd Basically, you needed the guictrlread inside the loop. Edited March 6, 2007 by xcal How To Ask Questions The Smart Way
totaln00ber Posted March 7, 2007 Author Posted March 7, 2007 Thanks, it works now; not sure what happened there, but I've got the logic down. : )
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