
-----------------------------------
momo2
Thu May 24, 2007 6:32 pm

i really need help with clicking by mouse to return to the main menu &quot;please look over&quot;
-----------------------------------
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


%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  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
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


-----------------------------------
Albrecd
Fri May 25, 2007 11:40 am

Re: i really need help with clicking by mouse to return to the main menu &quot;please look over&quot;
-----------------------------------
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.
