BoBo Posted September 29, 2005 Posted September 29, 2005 hiho I have searched and searched but i cant find any help. maybe you are able to help me my problem is that ... i want to use checkboxes and i want to check if they are activated or not if i use GuiCtrlRead($Checkbox) ill get only the Controlid from the box if i use GuiCtrlgetState($Checkbox) ill only get an 80 dont know what it is for. but whether they are checked or not i get only the same value but i need to work with TRUE or FALSE ... 0 or 1 something that let me decide. plz help guys
Puckmeister Posted September 29, 2005 Posted September 29, 2005 hi,hope that helps you#include <GUIConstants.au3>GUICreate ("CheckState", 120, 60)$check = GUICtrlCreateCheckbox ("My Checkbox", 10, 10, 100, 20)$but = GUICtrlCreateButton ("Get State", 10, 30, 100, 20)GuiSetState()While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop ElseIf $msg = $but Then $state = GuiCtrlRead ($check) If $state = 1 Then $state_text = "Checked" Else ;unchecked=4 $state_text = "Unchecked" EndIf MsgBox (0,"State", $state_text) EndIfWendgreets, chris
jpm Posted September 29, 2005 Posted September 29, 2005 hihoI have searched and searched but i cant find any help.maybe you are able to help memy problem is that ... i want to use checkboxes and i want to check if they are activated or notif i use GuiCtrlRead($Checkbox) ill get only the Controlid from the boxif i use GuiCtrlgetState($Checkbox) ill only get an 80 dont know what it is for.but whether they are checked or not i get only the same value but i need to work withTRUE or FALSE ... 0 or 1 something that let me decide.plz help guysGuiCtrlRead($Checkbox) return the state so you can test it with $GUI_CHECKED. remember you can have several state so the correct checking must be done with BitAnd(GuiCtrlRead($Checkbox), $GUI_CHECKED)GuiCtrlgetState($Checkbox) as stated in the docAs opposed to GUICtrlRead this function returns only the state of a control (disabled/hidden/etc)
BoBo Posted September 29, 2005 Author Posted September 29, 2005 (edited) thx chris that helped alot thx thx needed that Edited September 29, 2005 by BoBo
Guest Jakub Hadraba Posted September 29, 2005 Posted September 29, 2005 Hi, here's another example with GUIEvent mode, shall you prefer this one. We get the state of the checkbox and display it in the label below it. Jakub (see att.)chkbox.au3
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