Exit a Program 
	 
	
		| Author | 
		Message | 
	 
		 
		syntax0r
 
 
 
    
		 | 
		
		
			
				  Posted: 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? | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		Tony
 
  
 
    
		 | 
		
		
			
				  Posted: Sun May 08, 2005 11:55 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| what GUI.quit does is it makes GUI.ProcessEvents return true. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		[Gandalf]
 
  
 
    
		 | 
		
		
			
				  Posted: Mon May 09, 2005 12:35 am    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
					  | code: | 	 		  
 
var window : int
 
window := Window.Open ("position:center;center,graphics:max;max")
 
Window.Close (window)
 
  | 	  
 
*oops, should have read that better    *
 
 
well... it does close the .exe - its not in the processes anymore... | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Token
 
  
 
    
		 | 
		
		
			
				  Posted: Mon May 09, 2005 2:26 pm    Post subject: (No 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. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		MysticVegeta
 
  
 
    
		 | 
		
		
			
				  Posted: Tue May 10, 2005 6:53 am    Post subject: (No 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  | 	 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |