Computer Science Canada

Exit a Program

Author:  syntax0r [ Sun May 08, 2005 10:56 pm ]
Post subject:  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
code:
  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?

Author:  Tony [ Sun May 08, 2005 11:55 pm ]
Post subject: 

what GUI.quit does is it makes GUI.ProcessEvents return true.

Author:  [Gandalf] [ Mon May 09, 2005 12:35 am ]
Post subject: 

code:

var window : int
window := Window.Open ("position:center;center,graphics:max;max")
Window.Close (window)

*oops, should have read that better Embarassed *

well... it does close the .exe - its not in the processes anymore...

Author:  Token [ Mon May 09, 2005 2:26 pm ]
Post subject: 

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,

code:


if q= true then
exit
end loop


and then at the very end do the window close thing and ur set.

Author:  MysticVegeta [ Tue May 10, 2005 6:53 am ]
Post subject: 

Or you could do something like this ->
code:

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 ->

code:
if GUI.GetEventWidgetID = quitBtn then
Window.Close(windID)
end if


: