GUI Troubles
Author |
Message |
shakin cookie
|
Posted: Wed Jan 09, 2008 8:04 pm Post subject: GUI Troubles |
|
|
Ok, so my final summative involves buttons, and i am having some trouble...
First off, let me state that my computer's teacher said that we must use Turing's GUI.
Now, on to the problem...
I have a lot of buttons, ad when i click on one, the previous button that has been near or in that spot is clicked, and it returns to the same procedure i am in.
This is hard to explain, so here is the code, so you all can take a look.
Is there a command to get rid of the overlapping?
Turing: |
import GUI
%Decleration Section
forward proc mainMenu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Program Title
proc title
cls
locate (1, 20)
var font : int
font := Font.New ("neurochrome:25")
Draw.Text ("PIMP MY RIDE", 110, 370, font, green)
end title
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%User Inputs, Buttons and direct procs
proc bumperfs1
title
var car : int := Pic.FileNew ("ferrari-s+c(r)+b(s).bmp")
Pic.Draw (car, 10, - 50, picCopy)
Pic.Free (car )
% var carButton : int := GUI.CreateButton (200, 235, 0, "Next Step", hubCapChoice1)
end bumperfs1
proc bumperChoice1
title
locate (5, 1)
put "Alex: This is where it really starts to get interesting! Choose your style of bumper!"
var bumperButtonfs1 : int := GUI.CreateButton (200, 260, 0, "Straight Bumper", bumperfs1 )
loop
exit when GUI.ProcessEvent
end loop
% var bumperButtonfs2 : int := GUI.CreateButton (200, 230, 0, "Bumpy Bumper", bumperfs2)
end bumperChoice1
proc colourfs1
title
var car : int := Pic.FileNew ("ferrari-s+c(r).bmp")
Pic.Draw (car, 10, - 50, picCopy)
Pic.Free (car )
var colourbuttonfsc : int := GUI.CreateButton (200, 40, 0, "Next Step", bumperChoice1 )
loop
exit when GUI.ProcessEvent
end loop
end colourfs1
proc colourChoice1
title
locate (5, 1)
put "Alex: 'K, now starts the true custimization process. Choose what colour you want your Spider to be!"
var colourButtonfs1 : int := GUI.CreateButton (200, 270, 0, "Ragin' Red", colourfs1 )
GUI.SetColour (colourButtonfs1, brightred)
loop
exit when GUI.ProcessEvent
end loop
end colourChoice1
proc ferrarim1
title
var car : int := Pic.FileNew ("ferrari-s.bmp")
Pic.Draw (car, 10, - 50, picCopy)
Pic.Free (car )
var carButton : int := GUI.CreateButton (200, 20, 0, "Next Step", colourChoice1 )
loop
exit when GUI.ProcessEvent
end loop
end ferrarim1
proc ferrari
title
locate (5, 1)
put "Alex: A'ight, this is the first stage of the game! Pick what model of ferrari you want!"
var modelfButton1 : int := GUI.CreateButton (200, 260, 0, "Ferrari Spider", ferrarim1 )
% var modelfButton2 : int := GUI.CreateButton (200, 180, 0, "Ferrrari Enzo", ferrarim2)
loop
exit when GUI.ProcessEvent
end loop
end ferrari
proc hummer
title
put "Zoom Zoom!"
end hummer
proc cooper
title
put "Zoom Zoom Zoom!"
end cooper
proc choice
title
var choiceButton1 : int := GUI.CreateButton (200, 250, 0, "Pimp A Ferrari", ferrari )
GUI.SetColour (choiceButton1, purple)
var choiceButton2 : int := GUI.CreateButton (200, 210, 0, "Pimp A Hummer", hummer )
GUI.SetColour (choiceButton2, 42)
var choiceButton3 : int := GUI.CreateButton (200, 170, 0, "Pimp A Mini Coopere", cooper )
GUI.SetColour (choiceButton3, brightblue)
loop
exit when GUI.ProcessEvent
end loop
end choice
proc instructions
title
locate (7, 1)
put "Alex: Ok dawg, here's the deal: You've just won a contest and have been flown down to L.A. Motors to pimp the ride of your choice."
put ""
put "You'll get to choose things from paint colour to hub cap design. So, what are you waiting for? It's time to pimp your ride!"
var insButton : int := GUI.CreateButton (200, 120, 0, "Return To Main Menu", mainMenu )
end instructions
proc goodBye
title
locate (10, 1)
put "Thanks for using this program. I hope you found it entertaining!"
put ""
put "Akiva Reiken"
GUI.Quit
end goodBye
body mainMenu
title
var menuButton1 : int := GUI.CreateButton (200, 200, 0, "Play Game", choice )
GUI.SetColour (menuButton1, brightred)
var menuButton2 : int := GUI.CreateButton (150, 150, 0, "Instructions", instructions )
GUI.SetColour (menuButton2, white)
var menuButton3 : int := GUI.CreateButton (100, 100, 0, "Quit", goodBye )
GUI.SetColour (menuButton3, brightgreen)
loop
exit when GUI.ProcessEvent
end loop
end mainMenu
mainMenu
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
|
|
|
|
Carey
|
Posted: Thu Jan 10, 2008 8:48 am Post subject: RE:GUI Troubles |
|
|
try using
code: |
GUI.Dispose ([buttonName])
|
|
|
|
|
|
|
shakin cookie
|
Posted: Thu Jan 10, 2008 4:35 pm Post subject: RE:GUI Troubles |
|
|
would i declare this right after i declare the button, or in the following procedure? |
|
|
|
|
|
Tony
|
Posted: Thu Jan 10, 2008 5:19 pm Post subject: RE:GUI Troubles |
|
|
You call this at whatever point you no longer want to use the button. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
shakin cookie
|
Posted: Fri Jan 11, 2008 5:10 pm Post subject: RE:GUI Troubles |
|
|
There's only one problem with that...
The next procedures are declared BEFORE the button...
therefor calling GUI.Dispose before would return an error message, and putting it after would make the button unusable at the time it is needed. |
|
|
|
|
|
Tony
|
Posted: Fri Jan 11, 2008 5:15 pm Post subject: RE:GUI Troubles |
|
|
well you probably shouldn't be hardcoding the references to GUI elements anyway. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
shakin cookie
|
Posted: Fri Jan 11, 2008 5:17 pm Post subject: RE:GUI Troubles |
|
|
my teacher announced that turing's GUI must be used. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Sean
|
Posted: Fri Jan 11, 2008 5:22 pm Post subject: Re: GUI Troubles |
|
|
Turing GUi is not recommened, I would tell your teacher not to use it, and for you to create your own buttons, without using GUI! |
|
|
|
|
|
Tony
|
Posted: Fri Jan 11, 2008 5:31 pm Post subject: RE:GUI Troubles |
|
|
That wouldn't matter, it would have the same problem of keeping track of which buttons are active at what time.
I didn't mean you should not use GUI. You can pass arguments to your procedures, so it shouldn't matter what procedure was declared before what. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
shakin cookie
|
Posted: Fri Jan 11, 2008 5:44 pm Post subject: RE:GUI Troubles |
|
|
how would i do that? |
|
|
|
|
|
SMasood
|
Posted: Sun Jan 13, 2008 8:38 pm Post subject: RE:GUI Troubles |
|
|
Use GUI.Hide (yourButton)
JEEZUS CHRIST AKIVA |
|
|
|
|
|
|
|