
-----------------------------------
Masta_911
Tue Jan 16, 2007 8:42 pm

Close turing
-----------------------------------
could someone tell me the code that will close turing output window

-----------------------------------
rdrake
Tue Jan 16, 2007 8:54 pm

RE:Close turing
-----------------------------------
You can halt execution, but you cannot close the main window itself.

-----------------------------------
Clayton
Tue Jan 16, 2007 9:34 pm

Re: Close turing
-----------------------------------
actually:

Window.Close (defWinID) ;)

EDIT: Dan, "defWinID" should be grey, as it is a predefined constant for Turing.

-----------------------------------
Masta_911
Tue Jan 16, 2007 10:17 pm

Re: Close turing
-----------------------------------
i got another problem now   :? 


% Open the window
var winID : int
winID := Window.Open ("position:300;300,graphics:200;200")

% Draw the random ovals in the box
var x, y, clr : int
for : 1 .. 20
    x := Rand.Int (0, maxx)             % Random x
    y := Rand.Int (0, maxy)             % Random y
    clr := Rand.Int (0, maxcolor)           % Random color
    Draw.FillOval (x, y, 30, 30, clr)
end for

var ch : char := getchar                    % Wait for input

Window.Close (winID)                    % Close the window


heres the code i got from turing help and i wanted to know if there is a way to initialize 'winID' without having to use Window.Open command.

-----------------------------------
Clayton
Tue Jan 16, 2007 11:36 pm

Re: Close turing
-----------------------------------
"defWinID" is the default window ID for the run window that pops open whenever you output something. Simply call Window.Close() with defWinID as the argument, and the default run window will close.

-----------------------------------
Masta_911
Wed Jan 17, 2007 8:02 am

RE:Close turing
-----------------------------------
if i use "defWinId" it gives me this error:
Close of standard stream -1 is not allowed

-----------------------------------
ericfourfour
Wed Jan 17, 2007 3:27 pm

RE:Close turing
-----------------------------------
You cannot close the default run window. You are allowed to hide to however.

Although, you can close windows other than the default one (but you got to open them first).

-----------------------------------
Masta_911
Wed Jan 17, 2007 4:29 pm

RE:Close turing
-----------------------------------
ok thanks.. i wanted to make a quit button for my game and what is the best way to do it. i got the mouse module working all i need to know is how to close the window when i click on the quit button

could someone please help

-----------------------------------
Masta_911
Wed Jan 17, 2007 8:54 pm

RE:Close turing
-----------------------------------
can someone please help me with the quit button 
thanks

-----------------------------------
ericfourfour
Wed Jan 17, 2007 9:09 pm

RE:Close turing
-----------------------------------
I read it the first time. Please don't double post.

Make a function that returns true if the button has been pressed.
if buttonPressed () then
    Window.Close (winID)
end if

-----------------------------------
Masta_911
Wed Jan 17, 2007 9:26 pm

Re: Close turing
-----------------------------------
i tried that but the it doesnt close it every time i click the button then it just flickers
heres the code

        if MouseInfo.X > 200 and MouseInfo.X < 600 and MouseInfo.Y > 212 and MouseInfo.Y < 261 then
            clos := true
        end if
        if clos = true then
            winID := Window.Open ("position:0;0,screen:max;max")
            Window.Close (winID)
        end if


-----------------------------------
ericfourfour
Wed Jan 17, 2007 9:28 pm

RE:Close turing
-----------------------------------
What are these two lines doing?

winID := Window.Open ("position:0;0,screen:max;max")
Window.Close (winID)

-----------------------------------
Masta_911
Wed Jan 17, 2007 9:32 pm

RE:Close turing
-----------------------------------
the first line initializes the winID variable|| dats the only way to initialize it as far as i know|| the second line is supposed to close the window which is not working at the moment

-----------------------------------
Clayton
Wed Jan 17, 2007 10:32 pm

Re: Close turing
-----------------------------------
but that's not the window that you are outputting stuff to... the flicker is a new window opening and then closing.... you need to open the window at the start of your program, set to active, output done, then the window closed.
