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

Username:   Password: 
 RegisterRegister   
 closing the unused windows
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ReN3g@de




PostPosted: Sat Jan 24, 2004 9:45 pm   Post subject: closing the unused windows

code:
import GUI
var count, fontT, fontTo, font1, font2, font3 : int := 0
font2 := Font.New ("Ariel:10:underline")
fontT := Font.New ("Ariel:11:bold")
font3 := Font.New ("Ariel:15:bold")
font1 := Font.New ("Papyrus:15:bold")
proc main
    var mainW : int := Window.Open ("title: PhreakShow,graphics:360;350,nobuttonbar")
    cls
    var iWindow : string (1) := ""
    var x, y, button : int := 0
    var b1, b2, aq, ac, co, bl, rd, gr : int := 0
    var temp : string (1)
    var file : int
    var textBox : int
    var title : int
    var exiter : int := 0
    var line : string
    cls
    View.Update
    GUI.SetBackgroundColour (black)
    Font.Draw ("Build Guides", 45, maxy - 70, fontT, 0)
    Font.Draw ("Tones", 245, maxy - 70, fontT, 0)
    Font.Draw ("Phreak Show", 120, maxy - 30, font1, 0)
    Font.Draw ("Made By:", 70, 20, font3, 0)
    Font.Draw ("ReN3g@de", 170, 20, font1, 0)
    drawline (maxx div 2, 50, maxx div 2, maxy - 50, 0)
    drawline (0, maxy - 80, maxx, maxy - 80, 0)
    drawline (0, 50, maxx, 50, 0)
    Font.Draw ("Beige Box", 60, maxy - 120, font2, 0)
    Font.Draw ("Aqua", 60, maxy - 145, font2, 0)
    Font.Draw ("Acrylic", 60, maxy - 170, font2, 0)
    Font.Draw ("Colour", 60, maxy - 195, font2, 0)
    Font.Draw ("Beige Box", 245, maxy - 120, font2, 0)
    Font.Draw ("Blue Box", 245, maxy - 145, font2, 0)
    Font.Draw ("Red Box", 245, maxy - 170, font2, 0)
    Font.Draw ("Green Box", 245, maxy - 195, font2, 0)
    loop
        Mouse.Where (x, y, button)
        if button = 1 and x >= 59 and x <= 120 and y >= 224 and y <= 244 then
            cls
            open : file, "b1.txt", get
            Font.Draw ("Return", 20, maxy - 50, fontT, 16)
            drawbox (18, maxy - 52, 70, maxy - 36, 16)
            textBox := GUI.CreateTextBoxFull (10, 10, 330, 265,
                GUI.INDENT, 0)
            loop
                exit when eof (file)
                get : file, line : *
                GUI.AddLine (textBox, line)
            end loop

            close : file

            loop
                exit when hasch
            end loop
            cls
            count := count + 1
            cls
            main
            cls
        elsif button = 1 and x >= 59 and x <= 95 and y >= 200 and y <= 217 then
            aq := aq + 1

        elsif button = 1 and x >= 59 and x <= 102 and y >= 175 and y <= 192 then
            ac := ac + 1

        elsif button = 1 and x >= 59 and x <= 100 and y >= 150 and y <= 167 then
            co := co + 1

        elsif button = 1 and x >= 244 and x <= 305 and y >= 224 and y <= 244 then
            b2 := b2 + 1
        elsif button = 1 and x >= 244 and x <= 300 and y >= 200 and y <= 217 then
            bl := bl + 1
        elsif button = 1 and x >= 244 and x <= 295 and y >= 175 and y <= 192 then
            rd := rd + 1
        elsif button = 1 and x >= 244 and x <= 304 and y >= 150 and y <= 167 then
            gr := gr + 1
        end if
    end loop
end main
loop
    main
end loop


i've been working on this program for a while now and so far the only link that works is Beige Box under the build Guides menu, but any way my question is:
how do i close the windows in behind that arent in use anymore?
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Sat Jan 24, 2004 9:52 pm   Post subject: (No subject)

Window.Close (winID)
GUI.CloseWindow (winID)

Note...Turing is weird...needless to say. Trying to close an Input window can screw you up...havn't test your code, so I'm not sure what exactly you're looking for.
ReN3g@de




PostPosted: Sun Jan 25, 2004 6:43 pm   Post subject: (No subject)

thanks Delos! i tried the Window.Close command before but it just screwed things up but with the GUI.CloseWindow its perfect except for one thing... Heres the code i have so far...

code:
import GUI
var count, fontT, fontTo, font1, font2, font3 : int := 0
font2 := Font.New ("Ariel:10:underline")
fontT := Font.New ("Ariel:11:bold")
font3 := Font.New ("Ariel:15:bold")
font1 := Font.New ("Papyrus:15:bold")
proc main
    var mainW : int := Window.Open ("title: PhreakShow,graphics:360;350,nobuttonbar")
    cls
    var iWindow : string (1) := ""
    var x, y, button : int := 0
    var b1, b2, aq, ac, co, bl, rd, gr : int := 0
    var temp : string (1)
    var file : int
    var textBox : int
    var title : int
    var exiter : int := 0
    var line : string
    cls
    View.Update
    GUI.SetBackgroundColour (black)
    Font.Draw ("Build Guides", 45, maxy - 70, fontT, 0)
    Font.Draw ("Tones", 245, maxy - 70, fontT, 0)
    Font.Draw ("Phreak Show", 120, maxy - 30, font1, 0)
    Font.Draw ("Made By:", 70, 20, font3, 0)
    Font.Draw ("ReN3g@de", 170, 20, font1, 0)
    drawline (maxx div 2, 50, maxx div 2, maxy - 50, 0)
    drawline (0, maxy - 80, maxx, maxy - 80, 0)
    drawline (0, 50, maxx, 50, 0)
    Font.Draw ("Beige Box", 60, maxy - 120, font2, 0)
    Font.Draw ("Aqua", 60, maxy - 145, font2, 0)
    Font.Draw ("Acrylic", 60, maxy - 170, font2, 0)
    Font.Draw ("Colour", 60, maxy - 195, font2, 0)
    Font.Draw ("Beige Box", 245, maxy - 120, font2, 0)
    Font.Draw ("Blue Box", 245, maxy - 145, font2, 0)
    Font.Draw ("Red Box", 245, maxy - 170, font2, 0)
    Font.Draw ("Green Box", 245, maxy - 195, font2, 0)
    loop
        Mouse.Where (x, y, button)
        if button = 1 and x >= 59 and x <= 120 and y >= 224 and y <= 244 then
            cls
            open : file, "b1.txt", get
            Font.Draw ("Press any key to return", 20, maxy - 50, fontT, 16)
            textBox := GUI.CreateTextBoxFull (10, 10, 330, 265,
                GUI.INDENT, 0)
            loop
                exit when eof (file)
                get : file, line : *
                GUI.AddLine (textBox, line)
            end loop

            close : file

            loop
                exit when hasch
            end loop
            cls
            GUI.CloseWindow (mainW)
            main
            cls
        elsif button = 1 and x >= 59 and x <= 95 and y >= 200 and y <= 217 then
            aq := aq + 1

        elsif button = 1 and x >= 59 and x <= 102 and y >= 175 and y <= 192 then
            ac := ac + 1

        elsif button = 1 and x >= 59 and x <= 100 and y >= 150 and y <= 167 then
            co := co + 1

        elsif button = 1 and x >= 244 and x <= 305 and y >= 224 and y <= 244 then
            b2 := b2 + 1
        elsif button = 1 and x >= 244 and x <= 300 and y >= 200 and y <= 217 then
            bl := bl + 1
        elsif button = 1 and x >= 244 and x <= 295 and y >= 175 and y <= 192 then
            rd := rd + 1
        elsif button = 1 and x >= 244 and x <= 304 and y >= 150 and y <= 167 then
            gr := gr + 1
        end if
    end loop
end main
loop
    main
end loop

some one try this program, and u'll notice that when u click the "Beige Box" area the test box containing the info doesnt work. the arrows and the scroll bar doesnt work. any ideas?
ReN3g@de




PostPosted: Sun Jan 25, 2004 10:13 pm   Post subject: (No subject)

^ Anybody got any ideas to why its not working ^

code:
   loop
                exit when hasch
            end loop

notice this part...if i change it to...
code:
loop
                exit when GUI.ProcessEvent
            end loop

then the text box scroll bars work but when i press a key the program stops...
what should i do?
McKenzie




PostPosted: Sun Jan 25, 2004 10:28 pm   Post subject: (No subject)

ReN3g@de wrote:


code:
   loop
                exit when hasch
            end loop



the problem is once one key is hit the hasch will stay true untill you dump the key. There is a new Input.purge (clear ?). You can just do a getch outside of your loop, it'll clear the one character from the input stream.
ReN3g@de




PostPosted: Mon Jan 26, 2004 3:52 pm   Post subject: (No subject)

thanks that works but the scroll bars still dont work...
McKenzie




PostPosted: Mon Jan 26, 2004 6:02 pm   Post subject: (No subject)

I kinda hate the GUI so I avoid it for the most part. attach your txt file and I'll look at the code closer.
Cervantes




PostPosted: Mon Jan 26, 2004 7:16 pm   Post subject: (No subject)

yeah I dislike GUI too. You can make your own that is totally customizable without too much trouble...
Sponsor
Sponsor
Sponsor
sponsor
DanShadow




PostPosted: Mon Jan 26, 2004 9:14 pm   Post subject: (No subject)

your code was too long...so I didnt examine it, so ill just post an example of closing and opening a window.
code:

var menu: int
menu:= Window.Open ("graphics:200;180,noecho,nocursor,title:The Title,offscreenonly,nobuttonbar,position:100;100")
put "Menu It ems whatever"
delay(5000)
Window.Close(menu)
var window:int
window:=Window.Open ("graphics:600;600,noecho,nocursor,title:The Main Program,offscreenonly,nobuttonbar,position:100;100")

I hope that helps in some way...
ReN3g@de




PostPosted: Tue Jan 27, 2004 5:43 pm   Post subject: (No subject)

heres the text file...


b1.txt
 Description:
The text file

Download
 Filename:  b1.txt
 Filesize:  839 Bytes
 Downloaded:  310 Time(s)

Cervantes




PostPosted: Tue Jan 27, 2004 6:04 pm   Post subject: (No subject)

too long as in too messy and unorganized
Method




PostPosted: Fri Jan 30, 2004 4:44 pm   Post subject: (No subject)

loop
exit when hasch or GUI.ProcessEvent
end loop

Simple.
Delos




PostPosted: Fri Jan 30, 2004 5:42 pm   Post subject: (No subject)

Method wrote:
loop
exit when hasch or GUI.ProcessEvent
end loop

Simple.


It appears that your picture does not want to display.

Perhaps netfirms does not allow hotlinking. Did I say perhaps?

Nice picture though...another one of your wonderful works in Photoshop I'd assume.
Method




PostPosted: Sat Jan 31, 2004 9:17 pm   Post subject: (No subject)

*Shrug*

Works for me.
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  [ 14 Posts ]
Jump to:   


Style:  
Search: