Valuater Posted June 4, 2005 Share Posted June 4, 2005 Once i press start... the stop button and the exit button do not function... but the tray icon button does?? Example script expandcollapse popup#include <GUIConstants.au3> $Quit="" GUICreate("my GUI") Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $Start= GUICtrlCreateButton("Start", 30, 55, 120, 25) GUICtrlSetOnEvent(-1, "Set_Start") $Stop= GUICtrlCreateButton("Stop", 30, 100, 120, 25) GUICtrlSetOnEvent(-1, "Set_Stop") $Exit= GUICtrlCreateButton("Exit", 30, 155, 120, 25) GUICtrlSetOnEvent(-1, "Set_Exit2") $Notice=GUICtrlCreateLabel(" Information Label", 20, 325, 540, 30) GUISetState() opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown. opt("TrayOnEventMode", 1) $exit_tray = TrayCreateItem ("Exit Program") TrayItemSetOnEvent (-1, "Set_Exit") TraySetState () While 1 Sleep(200) WEnd ;---------------- Functions-------------- Func Set_Exit() GUICtrlSetData($Notice, " Tray - Exit Working") Sleep(2000) Exit EndFunc Func Set_Exit2() GUICtrlSetData($Notice, " Button - Exit Working") Sleep(1000) Exit EndFunc Func Set_Stop() GUICtrlSetData($Notice, " Stop Button - Working") $Quit="stop" Sleep(1000) EndFunc Func Set_Start() GUICtrlSetData($Notice, " Start Button - Working") Sleep(1000) While 2 GUICtrlSetData($Notice, " Start Button - Still Working") Sleep(1000) If $QUIT <>"" then $Quit="" ExitLoop EndIf GUICtrlSetData($Notice, " Start Button - Recycling") Sleep(1000) WEnd EndFunc any way to re-poll the stop and exit buttons while the start process is running? thanks Link to comment Share on other sites More sharing options...
GaryFrost Posted June 5, 2005 Share Posted June 5, 2005 expandcollapse popup#include <GUIConstants.au3> $Quit="" GUICreate("my GUI") Opt("GUIOnEventMode", 1); Change to OnEvent mode $Start= GUICtrlCreateButton("Start", 30, 55, 120, 25) GUICtrlSetOnEvent($Start, "Set_Start") $Stop= GUICtrlCreateButton("Stop", 30, 100, 120, 25) GUICtrlSetOnEvent($Stop, "Set_Stop") $Exit= GUICtrlCreateButton("Exit", 30, 155, 120, 25) GUICtrlSetOnEvent($Exit, "Set_Exit2") $Notice=GUICtrlCreateLabel(" Information Label", 20, 325, 540, 30) $Loop = 0 GUISetState() opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown. opt("TrayOnEventMode", 1) $exit_tray = TrayCreateItem ("Exit Program") TrayItemSetOnEvent ($exit_tray, "Set_Exit") TraySetState () While 1 Sleep(200) If ($Loop) Then _Start_Loop() WEnd ;---------------- Functions-------------- Func Set_Exit() $Loop = 0 GUICtrlSetData($Notice, " Tray - Exit Working") Sleep(2000) Exit EndFunc Func Set_Exit2() $Loop = 0 GUICtrlSetData($Notice, " Button - Exit Working") Sleep(1000) Exit EndFunc Func Set_Stop() $Loop = 0 GUICtrlSetData($Notice, " Stop Button - Working") $Quit="stop" Sleep(1000) EndFunc Func Set_Start() GUICtrlSetData($Notice, " Start Button - Working") Sleep(1000) $Loop = 1 EndFunc Func _Start_Loop() While $Loop GUICtrlSetData($Notice, " Start Button - Still Working") Sleep(1000) If $QUIT <>"" then $Quit="" ExitLoop EndIf GUICtrlSetData($Notice, " Start Button - Recycling") Sleep(1000) WEnd EndFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GaryFrost Posted June 5, 2005 Share Posted June 5, 2005 (edited) These are not like vb events where multiple events can be fired, I would think of it more like a function being assigned to a button, and until that function returns control to the main routine, no other functions "events" can be fired. That's my thought on how these work. Edited June 5, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Valuater Posted June 5, 2005 Author Share Posted June 5, 2005 Func _Start_Loop() While $Loop GUICtrlSetData($Notice, " Start Button - Still Working") Sleep(1000) If $QUIT <>"" then $Quit="" ExitLoop EndIf GUICtrlSetData($Notice, " Start Button - Recycling") Sleep(1000) WEnd EndFunc<{POST_SNAPBACK}>Thanks ... gafrostI'm really not sure if i could have figured that one outbtwYour Codewizard is GreatThanks again Link to comment Share on other sites More sharing options...
Valuater Posted June 5, 2005 Author Share Posted June 5, 2005 These are not like vb events where multiple events can be fired, I would think of it more like a function being assigned to a button, and until that function returns control to the main routine, no other functions "events" can be fired.That's my thought on how these work.<{POST_SNAPBACK}>But. if thats true, then why do the tray functions continue to "fire"??? Link to comment Share on other sites More sharing options...
GaryFrost Posted June 5, 2005 Share Posted June 5, 2005 (edited) Forgot about those still working, might be something to post for possible bug? TrayEvents still work, but GuiCtrlEvents don't once GuiCtrlEvent occurs until "Event" returns control. Edited June 5, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Valuater Posted June 5, 2005 Author Share Posted June 5, 2005 That creates another question/problem I dont want to work this direction unless it is possible i will try to include my questiojn in your example Func _Start_Loop() While $Loop GUICtrlSetData($Notice, " Start Button - Still Working") Sleep(1000) If $QUIT <>"" then $Quit="" ExitLoop EndIf If $1x = "go" then call("program1") If $2x = "go" Then Call("program2") ;If $3x=............. and on and on ??? GUICtrlSetData($Notice, " Start Button - Recycling") Sleep(1000) WEnd EndFunc Is this possible???? Thanks Link to comment Share on other sites More sharing options...
GaryFrost Posted June 5, 2005 Share Posted June 5, 2005 Here's another thing to look at, start using the start in the tray the stop button works, but the tray exit doesn't, not until you use the stop button then you'll see the tray exit. expandcollapse popup#include <GUIConstants.au3> $Quit="" GUICreate("my GUI") Opt("GUIOnEventMode", 1); Change to OnEvent mode $Start= GUICtrlCreateButton("Start", 30, 55, 120, 25) GUICtrlSetOnEvent($Start, "Set_Start") $Stop= GUICtrlCreateButton("Stop", 30, 100, 120, 25) GUICtrlSetOnEvent($Stop, "Set_Stop") $Exit= GUICtrlCreateButton("Exit", 30, 155, 120, 25) GUICtrlSetOnEvent($Exit, "Set_Exit2") $Notice=GUICtrlCreateLabel(" Information Label", 20, 325, 540, 30) GUISetState() opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown. opt("TrayOnEventMode", 1) $start_tray = TrayCreateItem ("Start") TrayItemSetOnEvent ($start_tray, "Set_Start") $exit_tray = TrayCreateItem ("Exit Program") TrayItemSetOnEvent ($exit_tray, "Set_Exit") TraySetState () While 1 Sleep(200) WEnd ;---------------- Functions-------------- Func Set_Exit() GUICtrlSetData($Notice, " Tray - Exit Working") Sleep(2000) Exit EndFunc Func Set_Exit2() GUICtrlSetData($Notice, " Button - Exit Working") Sleep(1000) Exit EndFunc Func Set_Stop() GUICtrlSetData($Notice, " Stop Button - Working") $Quit="stop" Sleep(1000) EndFunc Func Set_Start() GUICtrlSetData($Notice, " Start Button - Working") Sleep(1000) While 1 GUICtrlSetData($Notice, " Start Button - Still Working") Sleep(1000) If $QUIT <>"" then $Quit="" ExitLoop EndIf GUICtrlSetData($Notice, " Start Button - Recycling") Sleep(1000) WEnd EndFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Valuater Posted June 5, 2005 Author Share Posted June 5, 2005 Thanks again gafrost.... but thats a difficult key combination for other users of my programcould you or someone reply on this question belowThat creates another question/problemI dont want to work this direction unless it is possiblei will try to include my questiojn in your exampleFunc _Start_Loop() While $Loop GUICtrlSetData($Notice, " Start Button - Still Working") Sleep(1000) If $QUIT <>"" then $Quit="" ExitLoop EndIf If $1x = "go" then call("program1") If $2x = "go" Then Call("program2") ;If $3x=............. and on and on ??? GUICtrlSetData($Notice, " Start Button - Recycling") Sleep(1000) WEndEndFuncIs this possible????Thanks<{POST_SNAPBACK}>Just want to know what direction to go nowthanks 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