MrChris Posted July 28, 2006 Share Posted July 28, 2006 I am trying to run a function if a check box is checked and and button is pressed cant get it to work. I tried reading the GUICtrlSetState and GUICtrlGetState but am not understanding it. Here is what I had/have that aint workin $Button1 = GUICtrlCreateButton("Test button", 224, 16, 137, 33, 0) GUICtrlSetTip(-1, "this is a test button") GUICtrlSetOnEvent(-1,"FileSetup") $CheckBox1 = GUICtrlCreateCheckbox("This is a test checkbox", 16, 56, 137, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetTip(-1, "this is a hint for this check box") Func FileSetup() GUISetState(@SW_HIDE) If $CheckBox1 = $GUI_CHECKED Then MsgBox(1024,"This is a test","This is a test") EndIf EndFunc Thanks, MrChris Link to comment Share on other sites More sharing options...
MHz Posted July 28, 2006 Share Posted July 28, 2006 Did you check the Gui Forum 1st? as this is GUI stuff. Use GUICtrlRead on the control handle. $Button1 = GUICtrlCreateButton("Test button", 224, 16, 137, 33, 0) GUICtrlSetTip(-1, "this is a test button") GUICtrlSetOnEvent(-1,"FileSetup") $CheckBox1 = GUICtrlCreateCheckbox("This is a test checkbox", 16, 56, 137, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetTip(-1, "this is a hint for this check box") Func FileSetup() GUISetState(@SW_HIDE) If GUICtrlRead($CheckBox1) = $GUI_CHECKED Then MsgBox(1024,"This is a test","This is a test") EndIf EndFunc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 28, 2006 Moderators Share Posted July 28, 2006 #include <GUICONSTANTS.AU3> Opt('GUIONEVENTMODE', 1) $MAIN = GUICreate('SOMETITLE', 500, 300) $Button1 = GUICtrlCreateButton("Test button", 224, 16, 137, 33, 0) GUICtrlSetTip(-1, "this is a test button") GUICtrlSetOnEvent(-1,"FileSetup") $CheckBox1 = GUICtrlCreateCheckbox("This is a test checkbox", 16, 56, 137, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetTip(-1, "this is a hint for this check box") GUISetState() While 1 Sleep(10000) WEnd Func FileSetup() GUISetState(@SW_HIDE) If BitAND(GUICtrlRead($CheckBox1), $GUI_CHECKED) = $GUI_CHECKED Then MsgBox(1024,"This is a test","This is a test") EndIf EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MrChris Posted July 28, 2006 Author Share Posted July 28, 2006 @ MHz Sorry I forgot I should post/read GUI related questions in the GUI form. But thanks that did the trick. MrChris Link to comment Share on other sites More sharing options...
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