| Window.Close 
 
	 
	
		| Author | Message |   
		| YasserSalama 
 
 
 
 
 | 
			
				|  Posted: Tue Jun 03, 2008 12:42 pm    Post subject: Window.Close |  |   
				| 
 |  
				| I have a program where it starts out by giving you two options; start and quit. I used the Window.Close command to get the quit button to work, but all it does is make the program finish and the window to minimize. I want to make it so it totally closes the window. Any help would be appreciated.
 P.S. You can take out the music file because it won't let the program work if you don't have the file.
 
 
 	  | code: |  	  | 
View.Set ("graphics:1024;768, offscreenonly, nobuttonbar")
 var winID : int
 var f1 : int := Font.New ("roaringfire:25:bold")
 var f2 : int := Font.New ("roaringfire:50:bold")
 var f3 : int := Font.New ("Roaringfire:30:bold")
 var mx, my, button : int
 
 process thunder
 Music.PlayFile ("storm-rainthunder5.wav")
 end thunder
 
 procedure Font_Pull (Text : string, X, Y, Font1, D, C : int)
 for I : 1 .. length (Text)
 cls
 Font.Draw (Text (1 .. I), X, Y, Font1, C)
 delay (D)
 View.Update
 end for
 end Font_Pull
 
 procedure introtext
 Font_Pull ("Two Families", 200, 550, f2, 100, white)
 delay (300)
 Font_Pull ("Sworn enemies from the beginning", 60, 400, f2, 100, white)
 delay (300)
 Font_Pull ("Only one member of each family survives", 1, 200, f3, 100, white)
 delay (300)
 Font_Pull ("And they must fight to finish it all", 50, 600, f2, 100, white)
 delay (500)
 Font_Pull ("Who wins is all up to you", 200, 300, f2, 100, white)
 delay (500)
 cls
 end introtext
 
 loop
 colorback (black)
 Font.Draw ("The Rivalry", 320, 550, f2, white)
 drawbox (120, 100, 340, 130, white)
 drawbox (670, 100, 890, 130, white)
 Font.Draw ("Start", 185, 107, f1, white)
 Font.Draw ("Quit", 740, 107, f1, white)
 View.Update
 delay (15)
 cls
 Mouse.Where (mx, my, button)
 if mx > 120 and mx < 340 and my > 100 and my < 130 then
 drawfillbox (120, 100, 340, 130, red)
 if button = 1 then
 cls
 fork thunder
 introtext
 delay (500)
 cls
 end if
 elsif mx > 670 and mx < 890 and my > 100 and my < 130 then
 drawfillbox (670, 100, 890, 130, red)
 if button = 1 then
 Window.Close (winID)
 end if
 end if
 end loop
 
 | 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| SNIPERDUDE 
 
  
 
 
 | 
			
				|  Posted: Tue Jun 03, 2008 1:54 pm    Post subject: RE:Window.Close |  |   
				| 
 |  
				| when you compile it, isn't there an option to close the programme once it is finished? 
 When you run it from turing it will only minimize it, but when you compile it should ask you if you want to leave it open once done or not.
 
 Hope that helps.
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| jeffgreco13 
 
  
 
 
 | 
			
				|  Posted: Tue Jun 03, 2008 2:04 pm    Post subject: Re: Window.Close |  |   
				| 
 |  
				| Almost positive this is your problem. winID is an empty variable. 
 
 	  | code: |  	  | 
var winID: int:= Window.Open(parameters)
 
 | 
 
 You place that code at the top. You don't really need that "View.Set" if you set your parameters properly.
 
 Check out the Turing documentation on exactly how to setup the Window.Open() command.
 
 That should make the window itself have an ID of "winID" so when you call the Window.Close(winID) it will close the main window. Check it out let us know.
 
 
 EVERYTHING ANSWERED BY GOOD OL' COMPSCI.CA
 http://compsci.ca/v3/printview.php?t=8901&start=0
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sean 
 
  
 
 
 | 
			
				|  Posted: Tue Jun 03, 2008 2:21 pm    Post subject: Re: Window.Close |  |   
				| 
 |  
				| The above is correct. You made a window variable, but never gave it paramters. That is why nothing happened. 
 
 	  | Turing: |  	  | 
var winID : int := Window.Open ("graphics:1024;768, offscreenonly, nobuttonbar") 
var  f1 : int := Font.New ("roaringfire:25:bold") 
var  f2 : int := Font.New ("roaringfire:50:bold") 
var  f3 : int := Font.New ("Roaringfire:30:bold") 
var  mx, my, button : int 
process  thunder 
    Music.PlayFile ("storm-rainthunder5.wav") 
end  thunder 
procedure  Font_Pull ( Text : string , X, Y, Font1, D, C : int) 
    for  I : 1 . . length ( Text) 
        cls 
        Font.Draw ( Text (1 . . I),  X, Y, Font1, C) 
        delay ( D) 
        View.Update 
    end for 
end  Font_Pull 
procedure  introtext 
 
    Font_Pull ("Two Families", 200 , 550 , f2, 100 , white) 
    delay (300) 
    Font_Pull ("Sworn enemies from the beginning", 60 , 400 , f2, 100 , white) 
    delay (300) 
    Font_Pull ("Only one member of each family survives", 1 , 200 , f3, 100 , white) 
    delay (300) 
    Font_Pull ("And they must fight to finish it all", 50 , 600 , f2, 100 , white) 
    delay (500) 
    Font_Pull ("Who wins is all up to you", 200 , 300 , f2, 100 , white) 
    delay (500) 
    cls 
end  introtext 
loop 
    colorback (black) 
    Font.Draw ("The Rivalry", 320 , 550 , f2, white) 
    drawbox (120 , 100 , 340 , 130 , white) 
    drawbox (670 , 100 , 890 , 130 , white) 
    Font.Draw ("Start", 185 , 107 , f1, white) 
    Font.Draw ("Quit", 740 , 107 , f1, white) 
    View.Update 
    delay (15) 
    cls 
    Mouse.Where ( mx, my, button) 
    if  mx > 120 and  mx < 340 and  my > 100 and  my < 130 then 
        drawfillbox (120 , 100 , 340 , 130 , red) 
        if  button = 1 then 
            cls 
            fork  thunder 
 
            introtext 
            delay (500) 
            cls 
        end if 
    elsif  mx > 670 and  mx < 890 and  my > 100 and  my < 130 then 
        drawfillbox (670 , 100 , 890 , 130 , red) 
        if  button = 1 then 
            Window.Close ( winID) 
        end if 
    end if 
end loop | 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| YasserSalama 
 
 
 
 
 | 
			
				|  Posted: Wed Jun 04, 2008 11:57 am    Post subject: RE:Window.Close |  |   
				| 
 |  
				| Thanks for the help but when I declare the variable winID with parameters, then when I hit quit, the window goes back to the default window (small size, button bar, etc.) I want it to just close totally. |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| YasserSalama 
 
 
 
 
 | 
			
				|  Posted: Wed Jun 04, 2008 12:02 pm    Post subject: RE:Window.Close |  |   
				| 
 |  
				| Oh. I tried putting in two Window.Close commands and it seemed to work. Thanks for the help guys! |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| gitoxa 
 
  
 
 
 | 
			
				|  Posted: Wed Jun 04, 2008 12:28 pm    Post subject: RE:Window.Close |  |   
				| 
 |  
				| Part of the problem might be that your progra mnever actually ends.  It's forever in the main loop until forcefully shut down. |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sean 
 
  
 
 
 | 
			
				|  Posted: Wed Jun 04, 2008 12:49 pm    Post subject: Re: Window.Close |  |   
				| 
 |  
				| The reason that it opens a second window, is because you aren't sending your output to your created window. Before you do anything in your procedures, use: Window.Select (WinID) 
 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		|  |  
 |