jonathanhafkamp Posted March 20, 2005 Posted March 20, 2005 Hey, How can you stop an function while running that function? Like this: #include <GuiConstants.au3> GuiCreate("Example") $button = GuiCtrlCreateButton("Click Me", 10, 10, 200, 200) GuiSetState(@SW_SHOW) While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $button Then oops_Function_That_Forgets_To_Check_GuiGetMsg() WEnd Func oops_Function_That_Forgets_To_Check_GuiGetMsg() While 1 sleep(100) WEnd EndFunc
Developers Jos Posted March 20, 2005 Developers Posted March 20, 2005 jonathanhafkamp said: Hey,How can you stop an function while running that function? Like this:<{POST_SNAPBACK}>You could use HotKeySet() which enables you to loop until the specified keycombo is pressed.... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Developers Jos Posted March 20, 2005 Developers Posted March 20, 2005 (edited) jonathanhafkamp said: I want to use a button<{POST_SNAPBACK}>Then you will have to use GuiGetMsg() to see if the button is clicked.......I guess iam not really understanding what you are trying to achieve here.... Edited March 20, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
MHz Posted March 20, 2005 Posted March 20, 2005 You could use a second instance of GUIGetMsg() ? Example: #include <GuiConstants.au3> GuiCreate("Example") $button = GuiCtrlCreateButton("Click Me", 10, 10, 200, 30) $button_out = GuiCtrlCreateButton("Click Me Out", 10, 50, 200, 30) GuiSetState(@SW_SHOW) While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $button Then oops_Function_That_Forgets_To_Check_GuiGetMsg() WEnd Func oops_Function_That_Forgets_To_Check_GuiGetMsg() While 1 $msg = GUIGetMsg() if $msg = $button_out Then ExitLoop sleep(100) WEnd EndFunc
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