GabrielSumner Posted July 23, 2008 Share Posted July 23, 2008 Hi everybody! I am new to AutoIt but I have some Java programming background so I was able to figure a lot of stuff on my own. But this time I am really stuck muttley my script is running in "GUIOnEventMode". What I want to do is: if one activates a checkbox the GUI shall display another control next to it, lets say an image. If on the other hand the checkbox is being unckecked the GUI shall set the visibility of the control to "false". The question is: is it possible to query the GUI constantly in "GUIOnEventMode"? Here is an example code, just some snippets: $H = GUICtrlCreateCheckbox("Higlight Mode", 54, 384, 97, 25) GUICtrlSetOnEvent(-1, "showHelp_H") ;------ Function ------- Func showHelp_H() If $H = $GUI_CHECKED Then GUICtrlSetState($help_me_H,$GUI_SHOW) ; $help_me_H is an image declared on some other place in the script ElseIf $H = $GUI_UNCHECKED Then GUICtrlSetState($help_me_H,$GUI_HIDE) EndIf EndFunc Thanks a lot ! Link to comment Share on other sites More sharing options...
picaxe Posted July 23, 2008 Share Posted July 23, 2008 Try Func showHelp_H() If BitAND(GUICtrlRead($H), $GUI_CHECKED) Then GUICtrlSetState($help_me_H, $GUI_SHOW) ; $help_me_H is an image declared on some other place in the script Else GUICtrlSetState($help_me_H, $GUI_HIDE) EndIf EndFunc Link to comment Share on other sites More sharing options...
billthecreator Posted July 24, 2008 Share Posted July 24, 2008 (edited) two things wrong... this is how it is $H = GUICtrlCreateCheckbox("Higlight Mode", 54, 384, 97, 25) GUICtrlSetOnEvent(-1, "showHelp_H") ;------ Function ------- Func showHelp_H() If BitAND(GUICtrlRead($h), $GUI_CHECKED) = $GUI_CHECKED Then; this is if it is checked when you press it then. GUICtrlSetState($$help_me_H, $GUI_HIDE) Else; but if it is unchecked when you press it then. GUICtrlSetState($$help_me_H, $GUI_SHOW) EndIf EndFunc Edited July 24, 2008 by billthecreator [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap Link to comment Share on other sites More sharing options...
GabrielSumner Posted July 24, 2008 Author Share Posted July 24, 2008 Great! Thanks a lot - it worked :-) Still have to learn a lot. I only had to put the two "Show" & "Hide" lines in the right order like this: GUICtrlSetState($$help_me_H,$GUI_SHOW ) Else GUICtrlSetState($$help_me_H, $GUI_HIDE) Ohterwise the control item got hidden when the checkbox was checked Thanks again! two things wrong... this is how it is $H = GUICtrlCreateCheckbox("Higlight Mode", 54, 384, 97, 25) GUICtrlSetOnEvent(-1, "showHelp_H") ;------ Function ------- Func showHelp_H() If BitAND(GUICtrlRead($h), $GUI_CHECKED) = $GUI_CHECKED Then; this is if it is checked when you press it then. GUICtrlSetState($$help_me_H, $GUI_HIDE) Else; but if it is unchecked when you press it then. GUICtrlSetState($$help_me_H, $GUI_SHOW) EndIf EndFunc 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