Problems with open/close command
Author |
Message |
at20092009
|
Posted: Mon Jan 14, 2013 9:48 am Post subject: Problems with open/close command |
|
|
%Screen 4
% import GUI
setscreen ("graphics:800;600,")
drawfillbox (0, 0, 800, 600, 118) %Screen
drawfillbox (0, 0, 800, 50, black) %Bottom line
drawfillbox (0, 0, 50, 600, black) %Left line
drawfillbox (0, 600, 800, 550, black) %Top line
% drawfillbox (800, 600, 750, 0, black) %Right line
var font4a : int := Font.New ("OCR A Std:40")
var font4b : int := Font.New ("Consolas Std:14")
var font4c : int := Font.New ("OCR A Std:20")
var font4d : int := Font.New ("OCR A Std:30")
Font.Draw ("Menu", 350, 500, font4a, 64)
Font.Draw ("If you order two pizzas the same", 55, 530, font4b, black)
Font.Draw ("size, you'll save $2 before taxes", 55, 510, font4b, black)
Font.Draw ("The computer screen size", 550, 530, font4b, black)
Font.Draw ("is 1920:1080", 600, 510, font4b, black)
% Font.Draw ("Eat-in", 500, 520, font4b, black)
% Font.Draw ("Take-out", 565, 520, font4b, black)
% Font.Draw ("Delivery", 660, 520, font4b, black)
% drawbox (520, 500, 530, 510, black)
% drawbox (600, 500, 610, 510, black)
% drawbox (690, 500, 700, 510, black)
Font.Draw ("Price List:", 140, 460, font4c, black)
drawline (140, 455, 260, 455, black)
Font.Draw ("Number:", 540, 460, font4c, black)
drawline (540, 455, 640, 455, black)
Font.Draw ("Small Pizza (Sauce and cheese) $7.50 -----------------", 100, 420, font4b, black)
drawfillbox (540, 420, 590, 430, black)
Font.Draw ("a", 600, 420, font4b, black)
Font.Draw (" additional item $0.30 ------------------------------------", 100, 400, font4b, black)
drawfillbox (540, 400, 590, 410, black)
Font.Draw ("b", 600, 400, font4b, black)
Font.Draw ("Medium Pizza (Sauce and cheese) $10.50 ------------", 100, 380, font4b, black)
drawfillbox (540, 380, 590, 390, black)
Font.Draw ("c", 600, 380, font4b, black)
Font.Draw (" additional item $0.50 ------------------------------------", 100, 360, font4b, black)
drawfillbox (540, 360, 590, 370, black)
Font.Draw ("d", 600, 360, font4b, black)
Font.Draw ("Large Pizza (Sauce and cheese) $12.50 ---------------", 100, 340, font4b, black)
drawfillbox (540, 340, 590, 350, black)
Font.Draw ("e", 600, 340, font4b, black)
Font.Draw (" additional item $0.65 ------------------------------------", 100, 320, font4b, black)
drawfillbox (540, 320, 590, 330, black)
Font.Draw ("f", 600, 320, font4b, black)
Font.Draw ("Extra Large Pizza (Sauce and cheese) $14.00 -------", 100, 300, font4b, black)
drawfillbox (540, 300, 590, 310, black)
Font.Draw ("g", 600, 300, font4b, black)
Font.Draw (" additional item $0.75 ------------------------------------", 100, 280, font4b, black)
drawfillbox (540, 280, 590, 290, black)
Font.Draw ("h", 600, 280, font4b, black)
Font.Draw ("Garlic Bread $2.50 ---------------------------------------------", 100, 260, font4b, black)
drawfillbox (540, 260, 590, 270, black)
Font.Draw ("i", 600, 260, font4b, black)
Font.Draw (" with cheese $3.00 ---------------------------------------", 100, 240, font4b, black)
drawfillbox (540, 240, 590, 250, black)
Font.Draw ("j", 600, 240, font4b, black)
Font.Draw ("Coffee $1.00 -----------------------------------------------------", 100, 220, font4b, black)
drawfillbox (540, 220, 590, 230, black)
Font.Draw ("k", 600, 220, font4b, black)
Font.Draw ("Tea $1.00 ---------------------------------------------------------", 100, 200, font4b, black)
drawfillbox (540, 200, 590, 210, black)
Font.Draw ("l", 600, 200, font4b, black)
Font.Draw ("Pop", 100, 180, font4b, black)
Font.Draw (" small $1.10 -------------------------------------------------", 100, 160, font4b, black)
drawfillbox (540, 160, 590, 170, black)
Font.Draw ("m", 600, 160, font4b, black)
Font.Draw (" large $1.80 -------------------------------------------------", 100, 140, font4b, black)
drawfillbox (540, 140, 590, 150, black)
Font.Draw ("n", 600, 140, font4b, black)
Font.Draw (" 2L $2.25 ----------------------------------------------------", 100, 120, font4b, black)
drawfillbox (540, 120, 590, 130, black)
Font.Draw ("o", 600, 120, font4b, black)
drawfillbox (540, 70, 630, 100, black)
Font.Draw ("Finish", 560, 80, font4b, white)
% var button4a : int := GUI.CreateButton (620, 60, 0, "Finish", GUI.Quit)
% var X, Y, B1, B2 : int
% var a, b, c : int := 0
% buttonchoose ("multibutton")
% loop
% buttonwait ("down", X, Y, B1, B2)
% if X >= 520 and Y >= 500 and X <= 530 and Y <= 510 then
% drawfillbox (520, 500, 530, 510, black)
% exit
% elsif X >= 600 and Y >= 500 and X <= 610 and Y <= 510 then
% drawfillbox (600, 500, 610, 510, black)
% exit
% elsif X >= 690 and Y >= 500 and X <= 700 and Y <= 510 then
% drawfillbox (690, 500, 700, 510, black)
% exit
% end if
% end loop
var screen4f : int
open : screen4f, "F:/Homework/2012-2013/ICS3U1-01/Final Program", put
var X, Y, B1, B2 : int
var a, b, c, d, e, f, g, h, i, j, k, l, m, n, o : int := 0
buttonchoose ("multibutton")
loop
buttonwait ("down", X, Y, B1, B2)
if X >= 540 and Y >= 420 and X <= 590 and Y <= 430 then
if B1 = 1 then
a := a + 1
locate (8, 55) %The original is (8,55)
put "a:", a
% put : screen4f, a
elsif B1 = 3 then
a := a - 1
locate (8, 55)
put "a:", a
% put : screen4f, a
end if
elsif X >= 540 and Y >= 400 and X <= 590 and Y <= 410 then
if B1 = 1 then
b := b + 1
locate (9, 85)
put "b:", b
elsif B1 = 3 then
b := b - 1
locate (9, 85)
put "b:", b
end if
elsif X >= 540 and Y >= 380 and X <= 590 and Y <= 390 then
if B1 = 1 then
c := c + 1
locate (10, 85)
put "c:", c
elsif B1 = 3 then
c := c - 1
locate (10, 85)
put "c:", c
end if
elsif X >= 540 and Y >= 360 and X <= 590 and Y <= 370 then
if B1 = 1 then
d := d + 1
locate (11, 85)
put "d:", d
elsif B1 = 3 then
d := d - 1
locate (11, 85)
put "d:", d
end if
elsif X >= 540 and Y >= 340 and X <= 590 and Y <= 350 then
if B1 = 1 then
e := e + 1
locate (12, 85)
put "e:", e
elsif B1 = 3 then
e := e - 1
locate (12, 85)
put "e:", e
end if
elsif X >= 540 and Y >= 320 and X <= 590 and Y <= 330 then
if B1 = 1 then
f := f + 1
locate (13, 85)
put "f:", f
elsif B1 = 3 then
f := f - 1
locate (13, 85)
put "f:", f
end if
elsif X >= 540 and Y >= 300 and X <= 590 and Y <= 310 then
if B1 = 1 then
g := g + 1
locate (14, 85)
put "g:", g
elsif B1 = 3 then
g := g - 1
locate (14, 85)
put "g:", g
end if
elsif X >= 540 and Y >= 280 and X <= 590 and Y <= 290 then
if B1 = 1 then
h := h + 1
locate (15, 85)
put "h:", h
elsif B1 = 3 then
h := h - 1
locate (15, 85)
put "h:", h
end if
elsif X >= 540 and Y >= 260 and X <= 590 and Y <= 270 then
if B1 = 1 then
i := i + 1
locate (16, 85)
put "i:", i
elsif B1 = 3 then
i := i - 1
locate (16, 85)
put "i:", i
end if
elsif X >= 540 and Y >= 240 and X <= 590 and Y <= 250 then
if B1 = 1 then
j := j + 1
locate (17, 85)
put "j:", j
elsif B1 = 3 then
j := j - 1
locate (17, 85)
put "j:", j
end if
elsif X >= 540 and Y >= 220 and X <= 590 and Y <= 230 then
if B1 = 1 then
k := k + 1
locate (18, 85)
put "k:", k
elsif B1 = 3 then
k := k - 1
locate (18, 85)
put "k:", k
end if
elsif X >= 540 and Y >= 200 and X <= 590 and Y <= 210 then
if B1 = 1 then
l := l + 1
locate (19, 85)
put "l:", l
elsif B1 = 3 then
l := l - 1
locate (19, 85)
put "l:", l
end if
elsif X >= 540 and Y >= 160 and X <= 590 and Y <= 170 then
if B1 = 1 then
m := m + 1
locate (20, 85)
put "m:", m
elsif B1 = 3 then
m := m - 1
locate (20, 85)
put "m:", m
end if
elsif X >= 540 and Y >= 140 and X <= 590 and Y <= 150 then
if B1 = 1 then
n := n + 1
locate (21, 85)
put "n:", n
elsif B1 = 3 then
n := n - 1
locate (21, 85)
put "n:", n
end if
elsif X >= 540 and Y >= 120 and X <= 590 and Y <= 130 then
if B1 = 1 then
o := o + 1
locate (22, 85)
put "o:", o
elsif B1 = 3 then
o := o - 1
locate (22, 85)
put "o:", o
end if
elsif X >= 540 and Y >= 70 and X <= 630 and Y <= 100 then
exit
end if
% exit when GUI.ProcessEvent
end loop
delay (2000)
close : screen4f
cls
drawfillbox (0, 0, 800, 600, 118) %Screen
drawfillbox (0, 0, 800, 50, black) %Bottom line
drawfillbox (0, 0, 50, 600, black) %Left line
drawfillbox (0, 600, 800, 550, black) %Top line
Font.Draw ("Would you like to", 250, 400, font4a, 64)
Font.Draw ("Eat-in, Take-out, or Delivery?", 250, 300, font4d, black)
Font.Draw ("Eat-in", 250, 250, font4b, black)
Font.Draw ("Take-out", 315, 250, font4b, black)
Font.Draw ("Delivery", 410, 250, font4b, black)
drawbox (270, 230, 280, 240, black)
drawbox (350, 230, 360, 240, black)
drawbox (440, 230, 450, 240, black)
loop
buttonwait ("down", X, Y, B1, B2)
if X >= 270 and Y >= 230 and X <= 280 and Y <= 240 then
drawfillbox (270, 230, 280, 240, black)
exit
elsif X >= 350 and Y >= 230 and X <= 360 and Y <= 240 then
drawfillbox (350, 230, 360, 240, black)
exit
elsif X >= 440 and Y >= 230 and X <= 450 and Y <= 240 then
drawfillbox (440, 230, 450, 240, black)
exit
end if
end loop
delay (2000)
cls |
|
|
|
|
|
Sponsor Sponsor
|
|
|
at20092009
|
Posted: Mon Jan 14, 2013 9:49 am Post subject: RE:Problems with open/close command |
|
|
Can someone help me with this? Check the red lines. They are open/close command, and I cannot store the data from the mouse command. |
|
|
|
|
|
Insectoid
|
Posted: Mon Jan 14, 2013 10:59 am Post subject: RE:Problems with open/close command |
|
|
From the documentation:
Quote:
On Microsoft Windows, one should note that opening files in other directories uses the backslash character. This is because the backslash is a special character in Turing (as in \t for tab and \n for a newline). To get a single backslash, use \\.
e.g. open : f, "C:\\STUDENTS\\SMITH\\ACCT.DAT", put
|
|
|
|
|
|
at20092009
|
Posted: Mon Jan 14, 2013 12:55 pm Post subject: RE:Problems with open/close command |
|
|
well, it's not that problem, I already tired that before. The question is when i click the button of a, the whole program just stopped and jump out. |
|
|
|
|
|
at20092009
|
Posted: Mon Jan 14, 2013 12:59 pm Post subject: RE:Problems with open/close command |
|
|
D; can you help me? Do I need to add something to stop the "if" part(but another question comes out, I don't know how to stop it, if i know it, i would use GUI command, not mouse command), so I can get the final value of "a"? |
|
|
|
|
|
at20092009
|
Posted: Mon Jan 14, 2013 1:03 pm Post subject: RE:Problems with open/close command |
|
|
I might know another way to store the data, but it does need the users to type in the "number of pizza", I really want just use the mouse command to collect these data, because the users just need to click. |
|
|
|
|
|
|
|