imani Posted October 6, 2007 Posted October 6, 2007 Anyone can tell me how to know if the state of a checkbox is changed. For example the user in the GUI has selected a box that was previously not selected
Zedna Posted October 6, 2007 Posted October 6, 2007 #include <GUIConstants.au3> GUICreate("My GUI Checkbox") $checkCN = GUICtrlCreateCheckbox ("CHECKBOX 1", 10, 10, 120, 20) $label1 = GUICtrlCreateLabel ("unchecked", 10, 50, 120, 20) GUISetState () While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $checkCN Then If IsChecked($checkCN ) Then $state = 'checked' Else $state = 'unchecked' EndIf GUICtrlSetData ($label1 , $state) EndIf Wend Func IsChecked($control) Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED EndFunc See AutoIt helpfile for details... Resources UDF ResourcesEx UDF AutoIt Forum Search
imani Posted October 6, 2007 Author Posted October 6, 2007 #include <GUIConstants.au3> GUICreate("My GUI Checkbox") $checkCN = GUICtrlCreateCheckbox ("CHECKBOX 1", 10, 10, 120, 20) $label1 = GUICtrlCreateLabel ("unchecked", 10, 50, 120, 20) GUISetState () While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $checkCN Then If IsChecked($checkCN ) Then $state = 'checked' Else $state = 'unchecked' EndIf GUICtrlSetData ($label1 , $state) EndIf Wend Func IsChecked($control) Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED EndFunc See AutoIt helpfile for details...Thanks Zedna For your help
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