Yata Posted August 10, 2008 Posted August 10, 2008 (edited) Bit of a simplistic question, but how do I retrieve the results from a check box control? Meaning checking if it's checked or not. I know to use GUIControlRead, I'm just lacking the method behind the madness. Thanks. Edited August 10, 2008 by Yata
picaxe Posted August 10, 2008 Posted August 10, 2008 #include <GUIConstantsEx.au3> Local $checkCN, $msg GUICreate("My GUI Checkbox") ; will create a dialog box that when displayed is centered $checkCN = GUICtrlCreateCheckbox("CHECKBOX 1", 10, 10, 120, 20) GUISetState() ; will display an dialog box with 1 checkbox While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $checkCN ConsoleWrite("CheckBox=" & BitAND(GUICtrlRead($checkCN), $GUI_CHECKED) & @LF) EndSelect WEnd
Yata Posted August 10, 2008 Author Posted August 10, 2008 I need it to do something depending on if it's checked, your example is really helpful but it only exchanges a numerical value where the checkbox is being evaluated as the action is executing, where I'm thinking I need to evaluate it first THEN do something with it depending on it's state.
picaxe Posted August 10, 2008 Posted August 10, 2008 #include <GUIConstantsEx.au3> Local $checkCN, $msg GUICreate("My GUI Checkbox") ; will create a dialog box that when displayed is centered $checkCN = GUICtrlCreateCheckbox("CHECKBOX 1", 10, 10, 120, 20) GUISetState() ; will display an dialog box with 1 checkbox While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $checkCN If BitAND(GUICtrlRead($checkCN), $GUI_CHECKED) Then ConsoleWrite("Do this when checked" & @LF) Else ConsoleWrite("Do this when not checked" & @LF) EndIf EndSelect WEnd
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