i really need help with clicking by mouse to return to the main menu "please look over"
Author |
Message |
momo2
|
Posted: Thu May 24, 2007 6:32 pm Post subject: i really need help with clicking by mouse to return to the main menu "please look over" |
|
|
okey i need help returining to the main menu wher the deposit withdraw and etc are after i click one of them take a look
Turing: |
%Import GUI
import GUI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Set graphics to max:max
setscreen ("graphics:max:max")
%globel variable
var balance : real
var font1 : int
var font2 : int
var font3 : int
var pinnum : int
var accnum : int
balance := 1000
font1 := Font.New ("Lucida Console:48:Bold")
font2 := Font.New ("Lucida Console:14")
font3 := Font.New ("sprint :25")
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%start of procedure
procedure Deposit
colourback (gray)
cls
drawfillbox (50, 50, 950, 600, black)
%declaring all variables
var deposit : real
var ch : string (1)
%Title of the procedure
Font.Draw ("DEPOSITS", 300, 400, font1, brightgreen)
colourback (black)
colour (white)
locate (25, 37)
%Asking for user input
put "Enter amount of deposit: $" ..
get deposit
%adding deposit to the balance
balance := balance + deposit
%outputing the new balance
put "Current balance: ", balance : 0 : 2
getch (ch )
%end of procedure
end Deposit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%start of the procedure
procedure Withdrawal
colourback (5)
cls
drawfillbox (50, 50, 950, 600, black)
%declare all variables
var withdrawal : real
%Title of the procedure
Font.Draw ("WITHDRAWALS", 300, 400, font1, brightgreen)
colourback (black)
colour (white)
locate (25, 37)
%asking for user input
put "Enter amount of withdrawal: $" ..
%user input
get withdrawal
%start of the outer if statement-only condition
if withdrawal <= balance then
%start of the innter if statement-first condition
if withdrawal rem 10 = 0 then
%takes amount of money out of the withdrawal
balance := balance - withdrawal
%for the error message
else
locate (26, 37)
put "Invaild amount(must be a multiple of 10)"
end if
%if the balance is less than withdrawal
else
locate (26, 37)
put "Insufficient Funds"
%end of the if statements
end if
%displays balance after withdrawa
put "Current balance: $", balance : 0 : 2
delay (3000)
%end of procedure
end Withdrawal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Start of procedure called FastCash
procedure FastCash
var choice : int
loop
colourback (gray)
cls
drawfillbox (50, 50, 750, 550, black)
Font.Draw ("FAST CASH", 300, 400, font1, brightgreen)
%Title of the procedure
colourback (black)
colour (white)
locate (25, 37)
%Prompt the user to choose an choiceion
put "Choose a choice"..
locate (27, 37)
put "1.) $10"..
locate (28, 37)
put "2.) $20"..
locate (29, 37)
put "3.) $40"..
locate (30, 37)
put "4.) $80"..
locate (31, 37)
put "5.) $100"..
locate (32, 37)
put "6.) Cancel"..
locate (34, 37)
put "Your choice: " ..
get choice
if choice = 1 then
if balance < 10 then
locate (33, 33)
put "Insufficient Funds"
delay (2000)
else
balance := balance - 10
exit when choice = 1
end if
elsif choice = 2 then
if balance < 20 then
locate (33, 33)
put "Insufficient Funds"
delay (2000)
else
balance := balance - 20
exit when choice = 2
end if
elsif choice = 3 then
if balance < 40 then
locate (33, 33)
put "Insufficient Funds"
delay (2000)
else
balance := balance - 40
exit when choice = 3
end if
elsif choice = 4 then
if balance < 80 then
locate (33, 33)
put "Insufficient Funds"
delay (2000)
else
balance := balance - 80
exit when choice = 4
end if
elsif choice = 5 then
if balance < 100 then
locate (33, 33)
put "Insufficient Funds"
delay (2000)
else
balance := balance - 100
exit when choice = 5
end if
elsif choice > 6 then
locate (33, 34)
put "Invaild Option"
delay (2000)
cls
else
locate (33, 34)
put "Cancelled"
exit when choice = 6
end if
end loop
put "Current Balance: ", balance : 0 : 2
delay (3000)
end FastCash
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Make procedure called balance
procedure Balance
%Display the current balance
put "Your Current Balance: $", balance
delay (3000)
%end of procedure
end Balance
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Make procedure called exit1
procedure exit1
%quits the program if user clicks exit
quit
%end of procedure
end exit1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
setscreen ("graphics:max;max")
%MAIN
%Clour the backgorund blue
colourback (blue)
cls
%Make title
Font.Draw ("Hello and welcome the Bank of Montreal's ATM Machine", 100, 600, font3, yellow)
locate (10, 1)
color (41)
%Ask user for input
put "Please enter your account number: " ..
%get input
get accnum
put ""
color (41)
%Ask user for input
put "enter your pin: " ..
%get input
get pinnum
cls
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
colourback (grey)
cls
drawfillbox (50, 50, 950, 600, black)
%Make titles for main
Font.Draw ("Bank Of Montreal", 100, 500, font1, blue)
Font.Draw ("MAIN MENU", 300, 400, font1, brightgreen)
Font.Draw ("How may I help you?", 350, 350, font2, white)
%Get picture from JPEG
Pic.ScreenLoad ("BMO logo.JPG", 700, 350, picCopy)
%Create buttons for mouse input
var button1 : int := GUI.CreateButton (400, 300, 0, "Deposit",Deposit )
var button2 : int := GUI.CreateButton (400, 250, 0, "Withdraw", Withdrawal )
var button3 : int := GUI.CreateButton (400, 200, 0, "FastCash", FastCash )
var button4 : int := GUI.CreateButton (400, 150, 0, "Balance", Balance )
var button5 : int := GUI.CreateButton (400, 100, 0, "exit", exit1 )
%begin loop for event
loop
exit when GUI.ProcessEvent
%end loop
end loop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Albrecd
|
Posted: Fri May 25, 2007 11:40 am Post subject: Re: i really need help with clicking by mouse to return to the main menu "please look over" |
|
|
Just put your wigits and GUI process loop inside another loop, and it will recreate your wigits after the procedure is complete (you may also have to use GUI.Dump).
Make sure you put in a way to exit the loop so it isn't infinite. |
|
|
|
|
![](images/spacer.gif) |
|
|