Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 need help closing program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nixsin




PostPosted: Tue May 26, 2009 11:04 am   Post subject: 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
Sponsor
Sponsor
Sponsor
sponsor
Siavash




PostPosted: Tue May 26, 2009 12:03 pm   Post subject: RE:need help closing program

try GUI.QUIT
it works in my program
BigBear




PostPosted: Tue May 26, 2009 2:31 pm   Post subject: 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

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




PostPosted: Tue May 26, 2009 2:56 pm   Post subject: Re: need help closing program

Here's what I think you want.
Turing:

var window : int := Window.Open ("graphics")
%code goes here.
Window.Close (window)
BigBear




PostPosted: Tue May 26, 2009 4:07 pm   Post subject: 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

Turing:
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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: