
-----------------------------------
nixsin
Tue May 26, 2009 11:04 am

need help closing program
-----------------------------------
OK we have a program that were doing for a project. In the program in the Main Menu we have a quit button that just minimizes the window and stops the program, but we need it to close the window completely. I've seen someone's program that does that but he/she still use the "quit" command... I just don't get it

-----------------------------------
Siavash
Tue May 26, 2009 12:03 pm

RE:need help closing program
-----------------------------------
try GUI.QUIT
it works in my program

-----------------------------------
BigBear
Tue May 26, 2009 2:31 pm

RE:need help closing program
-----------------------------------
GUI.QUIT probably quits the GUI module 

quit crashes the program which is no what you want to use 

Once a program has no more code it will finish so without a loop it will read the code and finish when it is done reading 

But a loop without an exit statement will continue forever and never finish unless you close it or end application etc

You need to exit your main loop with the options to play

loop
put Instructions
get input
if input = "1" then
play
end if
exit when input = "2"
end loop

You can also put exit in an if condition

-----------------------------------
Dusk Eagle
Tue May 26, 2009 2:56 pm

Re: need help closing program
-----------------------------------
Here's what I think you want.

var window : int := Window.Open ("graphics")
%code goes here.
Window.Close (window)


-----------------------------------
BigBear
Tue May 26, 2009 4:07 pm

RE:need help closing program
-----------------------------------
Make sure you use window.Close after all of your other code don't try to use this to quit the program

for example

loop
get input
if input = "q" then
Window.Close(winID)
end if
end loop

Turing will not exit the loop and will say I need to get input with a cursor so and will open the default window again.

You can close your program and see which line says program interrupted and see why it is there when it should be finished, probably need to exit a loop
