Get rid of buttons after entering a procedure... help
Author |
Message |
HelloWorld
|
Posted: Mon Nov 08, 2004 9:25 pm Post subject: Get rid of buttons after entering a procedure... help |
|
|
I need help please, my problem:
After clicking into a procedure, is there a way to get rid of the buttons. Like they disappear because I cls, but when you click in the spot where the button used to be, it appears..... Anyone understand what Im taking about?,,, |
|
|
|
|
|
Sponsor Sponsor
|
|
|
myob
|
Posted: Mon Nov 08, 2004 9:31 pm Post subject: (No subject) |
|
|
let say when u declare it, it looks like this
code: | var button1:=GUI.CreateButton(..bla bla bla) |
then whenever u want to get rid of it, u gonna do this
code: | GUI.Hide(button1)
GUI.Disable(button1)
cls |
that should clear things up, it gets dirty when u need to clear and disable a lot of them, you either have to hide it or cls, so if u gonna cls dont bother hide it. i think that's how i used to do it. |
|
|
|
|
|
HelloWorld
|
Posted: Mon Nov 08, 2004 9:52 pm Post subject: (No subject) |
|
|
I get an error, it says variable no declare, even though it is... |
|
|
|
|
|
myob
|
Posted: Mon Nov 08, 2004 9:56 pm Post subject: (No subject) |
|
|
post ur codes. |
|
|
|
|
|
HelloWorld
|
Posted: Mon Nov 08, 2004 10:46 pm Post subject: (No subject) |
|
|
Okay, well, Ill just post the whole program, sorry its a lot of code.... The reason I didnt post it right away is for that reason, its long...
code: |
import GUI
setscreen ("graphics:800;550") %Size of screen
%----------------------VARIABLES-------------------------------
%var text2 : int := Font.New ("Arial:35:Bold")
const gst := 0.07
const pst := 0.08
var n : int %How many parts; how many loops.
var total : int := 0
var reply : string (1) %variable to use with getch command
var name, tel, dat, make, year, mile, license, col, serial, inspect, tobe, need : string
%--------------------------------------------------------------
procedure start
cls
%----------------------Program info/intro----------------------------
put ""
var fontID1 : int := Font.New ("Impact:32:bold")
Font.Draw ("GDHS", 345, 450, fontID1, black)
var fontID2 : int := Font.New ("Georgia:24:bold")
Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
var fontID3 : int := Font.New ("Georgia:24:bold")
Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)
var fontID4 : int := Font.New ("Times New Roman:20:bold")
Font.Draw ("::Receipt Creater:.", 238, 325, fontID4, black)
drawline (0, 451, 800, 451, black)
drawline (0, 450, 800, 450, black)
locate (18, 20)
put "You will be promt with many questions. Please answer all of them."
locate (20, 40)
put "WHEN READY; PRESS ANY KEY" ..
getch (reply)
cls
%--------------------------------------------------------------
%------------Values for each Variable (input)------------------
put "Please fill in all the blanks."
put "If you don't know the answer, simply skip the question."
put "", skip
put "Customers Name: " ..
get name : *
put "Telephone #: " ..
get tel : *
put "Current Date (m/d/y): " ..
get dat : *
put "Vehicle Make: " ..
get make : *
put "Year: " ..
get year : *
put "Mileage: " ..
get mile : *
put "License #: " ..
get license : *
put "Colour: " ..
get col : *
put "Serial #: " ..
get serial : *
put "Inspected by: " ..
get inspect : *
put "", skip
put "Work to be done: " ..
get tobe : *
put ""
put "Work needed: " ..
get need : *
put "", skip
put "Press any key to continue to the next set of questions." ..
getch (reply)
cls
%--------------------------------------------------------------
%-----------------The second input-----------------------------
put "Please fill in all the blanks."
put "If you don't know the answer, type 'UNKNOWN'."
put "", skip
put "How many parts were purchased? " ..
get n
%--Vars for counter----
var part, pname : array 1 .. n of string
var quantity, price, netprice : array 1 .. n of int
var amounts : array 1 .. n of int
var total2 : int := 0
for counter : 1 .. n
put "What is the part number? " ..
get part (counter)
put "How many of this part was purchased? " ..
get quantity (counter)
put "What is the parts name? " ..
get pname (counter) : *
put "What is the Net price of this part? " ..
get netprice (counter)
put "What is the Unit price for this part? " ..
get price (counter)
end for
put "", skip
put "Press any key to continue." ..
getch (reply)
cls
%--------------------------------------------------------------
%-------------------------OUTPUT.......------------------------
var stallion : int := Pic.FileNew ("stang.bmp")
Pic.Draw (stallion, 0, 480, 0)
var fontID : int := Font.New ("Arial:14:bold")
locate (4, 35)
put "GDHS TRANSPORTATION DEPARTMENT"
put ""
locate (6, 25)
put "Customers Name: ", name
locate (6, 60)
put "Telephone #: ", tel
locate (7, 25)
put "Date: ", dat
locate (7, 60)
put "Vehical Make: ", make
locate (8, 25)
put "Year: ", year
locate (8, 60)
put "Mileage: ", mile
locate (9, 25)
put "License #: ", license
locate (9, 60)
put "Colour: ", col
locate (10, 25)
put "Serial #: ", serial
locate (10, 60)
put "Inspected by: ", inspect
put ""
put "Work to be done: ", tobe
put ""
put ""
drawline (0, 346, 800, 346, black) %For over top of work needed.
drawline (0, 345, 800, 345, black) %Same
put "Work needed: ", need
put "", skip
drawline (0, 290, 650, 290, black)
locate (18, 1)
put "Quantity"
locate (18, 18)
put "Part#"
locate (18, 34)
put "Name"
locate (18, 50)
put "Unit Price"
locate (18, 66)
put "Net Price"
for counter : 1 .. n
put quantity (counter), "\t\t", part (counter), " \t\t", pname (counter), "\t\t", price (counter), "\t\t", netprice (counter)
total += price (counter) * quantity (counter)
end for
put "", skip
locate (21 + n, 66)
put "Sub Total: $", total
locate (22 + n, 66)
put "GST: $", gst * total
locate (23 + n, 66)
put "PST: $", pst * total
locate (24 + n, 66)
put "Total: $", total * (gst + pst) + total %price (counter) * quantity (counter) * tax
put ""
put "", skip
put "" : 5, "Paid:__________" : 35, "Customer Signature :____________________"
%--------------------------------------------------------------
end start
procedure credit
cls
Pic.ScreenLoad ("bstang.bmp", 0, 0, picMerge) % Corner image
var fontID1 : int := Font.New ("Impact:32:bold")
Font.Draw ("GDHS", 345, 450, fontID1, black)
var fontID2 : int := Font.New ("Georgia:24:bold")
Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
var fontID3 : int := Font.New ("Georgia:24:bold")
Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)
var fontID4 : int := Font.New ("Times New Roman:20:bold")
Font.Draw ("::Credits:.", 238, 325, fontID4, black)
drawline (0, 451, 800, 451, black)
drawline (0, 450, 800, 450, black)
locate (16, 40)
put "PROGRAMMER TEAM"
locate (17, 40)
put "Lead Programmer- Josh English"
locate (18, 40)
put "Co-Programmer- Matt Watts"
locate (20, 40)
put "OTHER"
locate (21, 40)
put "Manual- Matt Watts"
locate (22, 40)
put "FlowChart- Matt Watts"
locate (24, 40)
put "OTHER RESOURCES"
locate (25, 40)
put "Turing 4.0.5"
locate (26, 40)
put "Turing Reference"
locate (27, 40)
put "Images- www.google.com"
locate (28, 40)
put "Teacher- Mr. Bathal"
end credit
procedure manual
cls
Pic.ScreenLoad ("bstang.bmp", 0, 0, picMerge) % Corner image
var fontID1 : int := Font.New ("Impact:32:bold")
Font.Draw ("GDHS", 345, 450, fontID1, black)
var fontID2 : int := Font.New ("Georgia:24:bold")
Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
var fontID3 : int := Font.New ("Georgia:24:bold")
Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)
var fontID4 : int := Font.New ("Times New Roman:20:bold")
Font.Draw ("::Manual:.", 238, 325, fontID4, black)
drawline (0, 451, 800, 451, black)
drawline (0, 450, 800, 450, black)
locate (17, 40)
put "This is the manual"
locate (18, 40)
put "First you will blah blah...!..."
locate (19, 40)
put "Watts is writting the rest of this :)!"
end manual
procedure done
cls
put "Thank You For Using This Program!" %Quit Message
Music.PlayFileStop
end done
%------------------MAIN MENU------------------------------------
Pic.ScreenLoad ("mustang.bmp", 0, 0, picMerge) % Background image
var fontID1 : int := Font.New ("Impact:32:bold")
Font.Draw ("GDHS", 345, 450, fontID1, black)
var fontID2 : int := Font.New ("Georgia:24:bold")
Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
var fontID3 : int := Font.New ("Georgia:24:bold")
Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)
drawline (0, 451, 800, 451, black)
drawline (0, 450, 800, 450, black)
var fontID4 : int := Font.New ("Times New Roman:20:bold")
Font.Draw ("::Menu:.", 238, 325, fontID4, 0)
Music.PlayFileLoop ("bgmusic.mp3") %Music is only temperary until I find something else, darn annoying street and car sounds
%-----------------Buttons & vars- Main Menu----------------------
locate (17, 48)
put "-Create a receipt" %Start Comment
var startb : int := GUI.CreateButton (300, 275, 70, "Start", start)
locate (19, 48)
put "-See who made this program" %Credit Comment
var creditb : int := GUI.CreateButton (300, 242, 70, "Credits", credit)
locate (21, 48)
put "-Instructions on how to use this program" %Manual Comment
var manualb : int := GUI.CreateButton (300, 210, 70, "Manual", manual)
locate (23, 48)
put "-Quit the program" %Quit Comment
var doneb : int := GUI.CreateButton (300, 178, 70, "Quit", done)
%----------------------------------------------------------------
loop
exit when GUI.ProcessEvent
end loop
cls
put "Thank You For Using This Program!"
Music.PlayFileStop
|
This is the program before I did the GUI.Disable thingie. It works fine, but it missing the following files that I have with it:
bgmusic.mp3
stang.bmp
mustang.bmp
bstang.bmp
... Okay thats it I guess... Thanks in advance, myob. |
|
|
|
|
|
myob
|
Posted: Mon Nov 08, 2004 11:26 pm Post subject: (No subject) |
|
|
here, i changed it for it to work
code: | import GUI
setscreen ("graphics:800;550") %Size of screen
%----------------------VARIABLES-------------------------------
%var text2 : int := Font.New ("Arial:35:Bold")
const gst := 0.07
const pst := 0.08
var n : int %How many parts; how many loops.
var total : int := 0
var reply : string (1) %variable to use with getch command
var name, tel, dat, make, year, mile, license, col, serial, inspect, tobe, need : string
%--------------------------------------------------------------
forward proc disable
procedure start
disable
cls
%----------------------Program info/intro----------------------------
put ""
var fontID1 : int := Font.New ("Impact:32:bold")
Font.Draw ("GDHS", 345, 450, fontID1, black)
var fontID2 : int := Font.New ("Georgia:24:bold")
Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
var fontID3 : int := Font.New ("Georgia:24:bold")
Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)
var fontID4 : int := Font.New ("Times New Roman:20:bold")
Font.Draw ("::Receipt Creater:.", 238, 325, fontID4, black)
drawline (0, 451, 800, 451, black)
drawline (0, 450, 800, 450, black)
locate (18, 20)
put "You will be promt with many questions. Please answer all of them."
locate (20, 40)
put "WHEN READY; PRESS ANY KEY" ..
getch (reply)
cls
%--------------------------------------------------------------
%------------Values for each Variable (input)------------------
put "Please fill in all the blanks."
put "If you don't know the answer, simply skip the question."
put "", skip
put "Customers Name: " ..
get name : *
put "Telephone #: " ..
get tel : *
put "Current Date (m/d/y): " ..
get dat : *
put "Vehicle Make: " ..
get make : *
put "Year: " ..
get year : *
put "Mileage: " ..
get mile : *
put "License #: " ..
get license : *
put "Colour: " ..
get col : *
put "Serial #: " ..
get serial : *
put "Inspected by: " ..
get inspect : *
put "", skip
put "Work to be done: " ..
get tobe : *
put ""
put "Work needed: " ..
get need : *
put "", skip
put "Press any key to continue to the next set of questions." ..
getch (reply)
cls
%--------------------------------------------------------------
%-----------------The second input-----------------------------
put "Please fill in all the blanks."
put "If you don't know the answer, type 'UNKNOWN'."
put "", skip
put "How many parts were purchased? " ..
get n
%--Vars for counter----
var part, pname : array 1 .. n of string
var quantity, price, netprice : array 1 .. n of int
var amounts : array 1 .. n of int
var total2 : int := 0
for counter : 1 .. n
put "What is the part number? " ..
get part (counter)
put "How many of this part was purchased? " ..
get quantity (counter)
put "What is the parts name? " ..
get pname (counter) : *
put "What is the Net price of this part? " ..
get netprice (counter)
put "What is the Unit price for this part? " ..
get price (counter)
end for
put "", skip
put "Press any key to continue." ..
getch (reply)
cls
%--------------------------------------------------------------
%-------------------------OUTPUT.......------------------------
var stallion : int := Pic.FileNew ("stang.bmp")
Pic.Draw (stallion, 0, 480, 0)
var fontID : int := Font.New ("Arial:14:bold")
locate (4, 35)
put "GDHS TRANSPORTATION DEPARTMENT"
put ""
locate (6, 25)
put "Customers Name: ", name
locate (6, 60)
put "Telephone #: ", tel
locate (7, 25)
put "Date: ", dat
locate (7, 60)
put "Vehical Make: ", make
locate (8, 25)
put "Year: ", year
locate (8, 60)
put "Mileage: ", mile
locate (9, 25)
put "License #: ", license
locate (9, 60)
put "Colour: ", col
locate (10, 25)
put "Serial #: ", serial
locate (10, 60)
put "Inspected by: ", inspect
put ""
put "Work to be done: ", tobe
put ""
put ""
drawline (0, 346, 800, 346, black) %For over top of work needed.
drawline (0, 345, 800, 345, black) %Same
put "Work needed: ", need
put "", skip
drawline (0, 290, 650, 290, black)
locate (18, 1)
put "Quantity"
locate (18, 18)
put "Part#"
locate (18, 34)
put "Name"
locate (18, 50)
put "Unit Price"
locate (18, 66)
put "Net Price"
for counter : 1 .. n
put quantity (counter), "\t\t", part (counter), " \t\t", pname (counter), "\t\t", price (counter), "\t\t", netprice (counter)
total += price (counter) * quantity (counter)
end for
put "", skip
locate (21 + n, 66)
put "Sub Total: $", total
locate (22 + n, 66)
put "GST: $", gst * total
locate (23 + n, 66)
put "PST: $", pst * total
locate (24 + n, 66)
put "Total: $", total * (gst + pst) + total %price (counter) * quantity (counter) * tax
put ""
put "", skip
put "" : 5, "Paid:__________" : 35, "Customer Signature :____________________"
%--------------------------------------------------------------
end start
procedure credit
disable
cls
Pic.ScreenLoad ("bstang.bmp", 0, 0, picMerge) % Corner image
var fontID1 : int := Font.New ("Impact:32:bold")
Font.Draw ("GDHS", 345, 450, fontID1, black)
var fontID2 : int := Font.New ("Georgia:24:bold")
Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
var fontID3 : int := Font.New ("Georgia:24:bold")
Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)
var fontID4 : int := Font.New ("Times New Roman:20:bold")
Font.Draw ("::Credits:.", 238, 325, fontID4, black)
drawline (0, 451, 800, 451, black)
drawline (0, 450, 800, 450, black)
locate (16, 40)
put "PROGRAMMER TEAM"
locate (17, 40)
put "Lead Programmer- Josh English"
locate (18, 40)
put "Co-Programmer- Matt Watts"
locate (20, 40)
put "OTHER"
locate (21, 40)
put "Manual- Matt Watts"
locate (22, 40)
put "FlowChart- Matt Watts"
locate (24, 40)
put "OTHER RESOURCES"
locate (25, 40)
put "Turing 4.0.5"
locate (26, 40)
put "Turing Reference"
locate (27, 40)
put "Images- www.google.com"
locate (28, 40)
put "Teacher- Mr. Bathal"
end credit
procedure manual
disable
cls
Pic.ScreenLoad ("bstang.bmp", 0, 0, picMerge) % Corner image
var fontID1 : int := Font.New ("Impact:32:bold")
Font.Draw ("GDHS", 345, 450, fontID1, black)
var fontID2 : int := Font.New ("Georgia:24:bold")
Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
var fontID3 : int := Font.New ("Georgia:24:bold")
Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)
var fontID4 : int := Font.New ("Times New Roman:20:bold")
Font.Draw ("::Manual:.", 238, 325, fontID4, black)
drawline (0, 451, 800, 451, black)
drawline (0, 450, 800, 450, black)
locate (17, 40)
put "This is the manual"
locate (18, 40)
put "First you will blah blah...!..."
locate (19, 40)
put "Watts is writting the rest of this :)!"
end manual
procedure done
disable
cls
put "Thank You For Using This Program!" %Quit Message
Music.PlayFileStop
end done
%------------------MAIN MENU------------------------------------
Pic.ScreenLoad ("mustang.bmp", 0, 0, picMerge) % Background image
var fontID1 : int := Font.New ("Impact:32:bold")
Font.Draw ("GDHS", 345, 450, fontID1, black)
var fontID2 : int := Font.New ("Georgia:24:bold")
Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
var fontID3 : int := Font.New ("Georgia:24:bold")
Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)
drawline (0, 451, 800, 451, black)
drawline (0, 450, 800, 450, black)
var fontID4 : int := Font.New ("Times New Roman:20:bold")
Font.Draw ("::Menu:.", 238, 325, fontID4, 0)
Music.PlayFileLoop ("bgmusic.mp3") %Music is only temperary until I find something else, darn annoying street and car sounds
%-----------------Buttons & vars- Main Menu----------------------
locate (17, 48)
put "-Create a receipt" %Start Comment
var startb : int := GUI.CreateButton (300, 275, 70, "Start", start)
locate (19, 48)
put "-See who made this program" %Credit Comment
var creditb : int := GUI.CreateButton (300, 242, 70, "Credits", credit)
locate (21, 48)
put "-Instructions on how to use this program" %Manual Comment
var manualb : int := GUI.CreateButton (300, 210, 70, "Manual", manual)
locate (23, 48)
put "-Quit the program" %Quit Comment
var doneb : int := GUI.CreateButton (300, 178, 70, "Quit", done)
%----------------------------------------------------------------
body proc disable
GUI.Disable (startb)
GUI.Disable (creditb)
GUI.Disable (manualb)
GUI.Disable (doneb)
end disable
loop
exit when GUI.ProcessEvent
end loop
cls
put "Thank You For Using This Program!"
Music.PlayFileStop
|
you see i use a procedure so it disables all buttons, and then i run that procedure in beginning of all other procedures. |
|
|
|
|
|
HelloWorld
|
Posted: Tue Nov 09, 2004 5:52 pm Post subject: (No subject) |
|
|
Thanks a bunch! Works great now! |
|
|
|
|
|
|
|