
-----------------------------------
syntax0r
Sun May 08, 2005 10:56 pm

Exit a Program
-----------------------------------
Im wondering if there's an efficient, user-friendly way for someone to exit a turing application?

I could make an option to close a window, but I am not sure the .EXE will be closed.

Then there's the   var buttonQuit : int := GUI.CreateButton (maxx div 2 - 51, maxy div 2 - 120, 0, "Quit", GUI.Quit) which does not actually "close" the window, just terminates the app.

Im stuck, any suggestions?

-----------------------------------
Tony
Sun May 08, 2005 11:55 pm


-----------------------------------
what GUI.quit does is it makes GUI.ProcessEvents return true.

-----------------------------------
[Gandalf]
Mon May 09, 2005 12:35 am


-----------------------------------

var window : int
window := Window.Open ("position:center;center,graphics:max;max")
Window.Close (window)

*oops, should have read that better  :oops: *

well... it does close the .exe - its not in the processes anymore...

-----------------------------------
Token
Mon May 09, 2005 2:26 pm


-----------------------------------
i'm not sure exactly how gui works but you could make it so that when quit returns a gui action or whatever var q:= true, and have in all your loops, 



if q= true then 
exit
end loop


and then at the very end do the window close thing and ur set.

-----------------------------------
MysticVegeta
Tue May 10, 2005 6:53 am


-----------------------------------
Or you could do something like this ->

var winID := Window.Open ("position:top;center,graphics:200;200")
loop
exit when GUI.ProcessEvent
end loop
Window.Close(winID)


So when the loop exits after pressing the GUI.Quit Button, the window closes.

Also what you can do is ->
After someone presses the Quit Button ->

if GUI.GetEventWidgetID = quitBtn then
Window.Close(windID)
end if
