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

Username:   Password: 
 RegisterRegister   
 Require some help with GUI Menu bars
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Lt.Riggs




PostPosted: Tue May 31, 2005 10:49 am   Post subject: Require some help with GUI Menu bars

The GUI Menu bar gets eraced when we set the backround colour and cls the screen, making it not visable.
code:
import GUI
View.Set ("screen")
var win := Window.Open ("position:top,center,graphics") %Determins the window ID
var first : int                % The menus.
var item : array 1 .. 1 of int        % The menu items.
var name : array 1 .. 2 of string (4) :=
    init ("Quit", "---")
forward proc exitwindow
% Create the menus
first := GUI.CreateMenu ("File")
item (1) := GUI.CreateMenuItem (name (1), exitwindow)
process my_background
    loop
        exit when GUI.ProcessEvent
    end loop
end my_background
fork my_background
body proc exitwindow
    Window.Close (win)
end exitwindow
colourback (black)
colour (white)
cls
%here we go
put skip
put "The Menu bar is still in a beta state. In order to use it you must bring your mouse to the top left corner of the screen and left click in order to view it."
delay (2000)
cls
put skip
var name1 : string
put "Please Enter Ye Name:  " ..
get name1 : *
put "Thank Ye"
delay (2000)
cls
put skip
var selection : int
put "Please choose ye class :"
put "Sorry We only have one class right now"
put "    1. Fighter          "
get selection
case selection of
    label 1 :
        cls
        put "Ye now be a soldier"
        %INSERT FIGHTER PICTURE
        delay (4000)
        cls
put skip
        end case
put "And the story begins..."
delay (1500)
locate (13, 20)
put "(a voice can be heard through the door)"
delay (2000)
%Rest of program...


Could someone please help me?
Sponsor
Sponsor
Sponsor
sponsor
jamonathin




PostPosted: Tue May 31, 2005 1:44 pm   Post subject: (No subject)

The way your program is set up isn't one of my personal favorites, but here, this will do since this is just an intro.

cls = drawfillbox (0, 0, maxx, maxy, backcolor)

Only difference is cls resets the locate on the put statements. There's not much text going on, so its fine the way it is.

You cant draw anything overtop of the menu, such as :

put skip
drawfillanything
cls
etc.

This code is really ugly though, I'm just trying to keep it to your format. If you wanna see how I'd do it, juss ask.
code:
import GUI
View.Set ("screen")
var win := Window.Open ("position:top,center,graphics") %Determins the window ID
colourback (black)
colour (white)
drawfillbox (0, 0, maxx, maxy - 50, black)
var first : int                % The menus.
var item : array 1 .. 1 of int        % The menu items.
var name : array 1 .. 2 of string (4) :=
    init ("Quit", "---")
forward proc exitwindow
% Create the menus
first := GUI.CreateMenu ("File")
item (1) := GUI.CreateMenuItem (name (1), exitwindow)
process my_background
    loop
        exit when GUI.ProcessEvent
    end loop
end my_background
fork my_background
body proc exitwindow
    Window.Close (win)
end exitwindow
%here we go
locate (5, 1)
put "The Menu bar is still in a beta state. In order to use it you must bring your mouse to the top left corner of the screen and left click in order to view it."
delay (2000)
drawfillbox (0, 0, maxx, maxy - 50, black)
put skip
var name1 : string
put "Please Enter Ye Name:  " ..
get name1 : *
put "Thank Ye"
delay (2000)
drawfillbox (0, 0, maxx, maxy - 50, black)
put skip
var selection : int
put "Please choose ye class :"
put "Sorry We only have one class right now"
put "    1. Fighter          "
get selection
case selection of
    label 1 :
        drawfillbox (0, 0, maxx, maxy - 50, black)
        put "Ye now be a soldier"
        %INSERT FIGHTER PICTURE
        delay (4000)
        drawfillbox (0, 0, maxx, maxy - 50, black)
        put skip
end case
put "And the story begins..."
delay (1500)
locate (13, 20)
put "(a voice can be heard through the door)"
delay (2000)
%Rest of program...


Lt.Riggs




PostPosted: Wed Jun 01, 2005 11:53 am   Post subject: (No subject)

alright i see what you have done, and thanks for the help.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: