Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 loopin GUI problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TryinghArd_noob




PostPosted: Tue Oct 12, 2004 11:42 am   Post subject: loopin GUI problem

hey!! great site...!!! only if i found it earlier... like last year Rolling Eyes i would be fatter ryt now.. Laughing nywy i have this bank machine project and im using GUI bottons to navigate... but the problem is that i have no idea how to go back to the main menu... well ill post the basic program that i have ryt now.. i took some so dat it wouldnt be long... my apology for the noob prog.. jst learnd dis weekend.. Embarassed Thanks in advance

code:
import GUI
setscreen ("offscreenonly")
var transaction_btn, mortgage_btn, mutual_fund_btn, quit_btn : int
var checking_btn, savings_btn, withdraw_btn, deposit_btn, balance_btn, paybill_btn, transfer_btn : int
var btn20, btn40, btn60, btn80, btn100, ohter_btn, other_btn, cancel_btn : int
var lop : int
procedure Quit
    quit
end Quit


procedure temporary
end temporary


procedure WITHDRAW
    GUI.Dispose (withdraw_btn)
    GUI.Dispose (deposit_btn)
    GUI.Dispose (balance_btn)
    GUI.Dispose (paybill_btn)
    GUI.Dispose (transfer_btn)
    GUI.Dispose (quit_btn)
    btn20 := GUI.CreateButton (250, 190, 60, "$20", temporary)
    btn40 := GUI.CreateButton (250, 150, 60, "$40", temporary)
    btn60 := GUI.CreateButton (250, 110, 60, "$60", temporary)
    btn80 := GUI.CreateButton (350, 190, 60, "$80", temporary)
    btn100 := GUI.CreateButton (350, 150, 60, "$100", temporary)
    other_btn := GUI.CreateButton (350, 110, 60, "OTHERS", temporary)
    cancel_btn := GUI.CreateButton (350, 70, 60, "QUIT", Quit)
end WITHDRAW

procedure DEPOSIT
end DEPOSIT

procedure BALANCE
end BALANCE

procedure PAYBILL
end PAYBILL

procedure TRANSFER
    return
end TRANSFER

procedure SAVINGS
    GUI.Dispose (savings_btn)
    GUI.Dispose (checking_btn)
    GUI.Dispose (quit_btn)
    withdraw_btn := GUI.CreateButton (250, 270, 60, "WITHDRAW", WITHDRAW)
    deposit_btn := GUI.CreateButton (250, 230, 60, "DEPOSIT", DEPOSIT)
    balance_btn := GUI.CreateButton (250, 190, 60, "BALANCE", BALANCE)
    paybill_btn := GUI.CreateButton (250, 150, 60, "PAY BILL", PAYBILL)
    transfer_btn := GUI.CreateButton (250, 110, 60, "TRANSFER ACCOUNT", TRANSFER)
    quit_btn := GUI.CreateButton (250, 70, 60, "QUIT", Quit)
end SAVINGS



procedure CHECKING
    GUI.Dispose (savings_btn)
    GUI.Dispose (checking_btn)
    GUI.Dispose (quit_btn)
    withdraw_btn := GUI.CreateButton (250, 270, 60, "WITHDRAW", WITHDRAW)
    deposit_btn := GUI.CreateButton (250, 230, 60, "DEPOSIT", DEPOSIT)
    balance_btn := GUI.CreateButton (250, 190, 60, "BALANCE", BALANCE)
    paybill_btn := GUI.CreateButton (250, 150, 60, "PAY BILL", PAYBILL)
    transfer_btn := GUI.CreateButton (250, 110, 60, "TRANSFER ACCOUNT", TRANSFER)
    quit_btn := GUI.CreateButton (250, 70, 60, "QUIT", Quit)
end CHECKING


procedure TRANSACTION
    cls
    GUI.Dispose (transaction_btn)
    GUI.Dispose (mortgage_btn)
    GUI.Dispose (mutual_fund_btn)
    savings_btn := GUI.CreateButton (250, 150, 60, "SAVINGS ACCOUNT", SAVINGS)
    checking_btn := GUI.CreateButton (250, 110, 60, "CHECKING ACCOUNT", CHECKING)
    quit_btn := GUI.CreateButton (250, 70, 60, "QUIT", Quit)
end TRANSACTION

procedure MORTGAGE
end MORTGAGE

procedure MUTUAL_FUND
end MUTUAL_FUND

procedure main_menu
    transaction_btn := GUI.CreateButton (250, 190, 60, "BANKING TRANSACTION", TRANSACTION)
    mortgage_btn := GUI.CreateButton (250, 150, 60, "MORTGAGE CALCULATION", MORTGAGE)
    mutual_fund_btn := GUI.CreateButton (250, 110, 60, "MUTUAL FUND INFORMATION", MUTUAL_FUND)
    quit_btn := GUI.CreateButton (250, 70, 60, "QUIT", Quit)

end main_menu

loop
    main_menu
    loop
        setscreen ("nooffscreenonly")
        exit when GUI.ProcessEvent
        setscreen ("offscreenonly")
    end loop
end loop
Sponsor
Sponsor
Sponsor
sponsor
Genesis




PostPosted: Tue Oct 12, 2004 2:11 pm   Post subject: (No subject)

What I would do is make it so that from the main menu, when the user clicks one of the buttons, it opens a new window with the new set of buttons in it. Then in the new window have a button that simply closes the window, and reverts back to the main window.

You can look up Window.Open, Window.Close, etc. in the Turing Reference. (I tried this way with your code and it works quite well.)
TryinghArd_noob




PostPosted: Tue Oct 12, 2004 2:41 pm   Post subject: (No subject)

but is there a way that i could do it in one window? caus its supose to be a bank machine... Sad

my god brain overload Shocked
shorthair




PostPosted: Tue Oct 12, 2004 2:58 pm   Post subject: (No subject)

Then why d oyou need a gui If its a Bank Machine ? Very Happy Very Happy Very Happy

GUI , is a hassle , especailly with gettting a button working twice , you have to reset is Parameters , with Boolean , and i hate doing it ( not difficult ) just a hassle , If your Just beginging with turing then Use new buttons , Its much easier ,
TryinghArd_noob




PostPosted: Tue Oct 12, 2004 3:17 pm   Post subject: (No subject)

Caus my teacher give marks for originality, since our class didn't took up GUI's... so i decided to used them..

whats the chance of having a classmate doing the exact thing? Very Happy
this so frustrating caus i spend 2 nigths learning GUI...

and wut do u mean by"new buttons" Rolling Eyes Question
TryinghArd_noob




PostPosted: Tue Oct 12, 2004 3:23 pm   Post subject: (No subject)

Rolling Eyes so those this mean that i have to rewrite my prog... Sad
caus i have to hand dis in 2morow
i have the other prog, all i need is a prog that goes back to the main menu
TryinghArd_noob




PostPosted: Wed Oct 13, 2004 2:25 am   Post subject: (No subject)

ah... that sucks.. theres no really chance on doing it ha... oh well Crying or Very sad
thanks anyway..
TryinghArd_noob




PostPosted: Wed Oct 13, 2004 9:35 pm   Post subject: (No subject)

Geezzz.... im a freakin stupid Laughing , i jst found out how to do it.. i dunno if this is the ryt way or some1 has done it... but hey it works for me Razz

if i haven't seen the tut "F9 and F10" i wouldn't figure this out Laughing thanks guys!!! Simplw all i just did was use GUI.Hide, GUI.Show, GUI.Refresh and stuff like dat, but kindda long but still works ryt?! jst wanna share to my fellow noobs out there, at least we have somethin 2 start with ryt?! 2 bad my project is late now Sad Crying or Very sad

anyways here it is... its up 2 u 2 add some stuff

code:

import GUI
setscreen ("offscreenonly")
var transaction_btn, mortgage_btn, mutual_fund_btn, quit_btn : int
var checking_btn, savings_btn, withdraw_btn, deposit_btn, balance_btn, paybill_btn, transfer_btn : int
var btn20, btn40, btn60, btn80, btn100, ohter_btn, other_btn, cancel_btn, back_btn, quit_btn2 : int
var lop : int
procedure Quit
    GUI.Quit
end Quit

procedure back_main
    locate (5, 5)
    put "MAIN MENU"
    GUI.Show (transaction_btn)
    GUI.Show (mortgage_btn)
    GUI.Show (mutual_fund_btn)
    GUI.Show (quit_btn)
    GUI.Hide (back_btn)
    GUI.Hide (quit_btn2)
    GUI.Refresh
end back_main


procedure removing2
    GUI.Hide (btn20)
    GUI.Hide (btn40)
    GUI.Hide (btn60)
    GUI.Hide (btn80)
    GUI.Hide (btn100)
    GUI.Hide (other_btn)
    GUI.Hide (cancel_btn)
    GUI.Refresh
    back_btn := GUI.CreateButton (10, 300, 60, "Return to main menu", back_main)
    quit_btn2 := GUI.CreateButton (10, 270, 60, "quit", Quit)
end removing2

procedure removing1
    GUI.Hide (withdraw_btn)
    GUI.Hide (deposit_btn)
    GUI.Hide (balance_btn)
    GUI.Hide (paybill_btn)
    GUI.Hide (transfer_btn)
    GUI.Refresh
    back_btn := GUI.CreateButton (10, 300, 60, "Return to main menu", back_main)
    quit_btn2 := GUI.CreateButton (10, 270, 60, "quit", Quit)
end removing1


procedure WITHDRAW
    GUI.Hide (withdraw_btn)
    GUI.Hide (deposit_btn)
    GUI.Hide (balance_btn)
    GUI.Hide (paybill_btn)
    GUI.Hide (transfer_btn)
    GUI.Hide (quit_btn)
    GUI.Refresh
    btn20 := GUI.CreateButton (10, 300, 60, "$20", removing2)
    btn40 := GUI.CreateButton (10, 270, 60, "$40", removing2)
    btn60 := GUI.CreateButton (10, 230, 60, "$60", removing2)
    btn80 := GUI.CreateButton (10, 190, 60, "$80", removing2)
    btn100 := GUI.CreateButton (10, 150, 60, "$100", removing2)
    other_btn := GUI.CreateButton (10, 110, 60, "OTHERS", removing2)
    cancel_btn := GUI.CreateButton (10, 70, 60, "QUIT", Quit)
end WITHDRAW

procedure DEPOSIT
    GUI.Hide (savings_btn)
    GUI.Hide (checking_btn)
    GUI.Hide (quit_btn)
    GUI.Refresh
    removing1
end DEPOSIT

procedure BALANCE
    GUI.Hide (savings_btn)
    GUI.Hide (checking_btn)
    GUI.Hide (quit_btn)
    GUI.Refresh
    removing1
end BALANCE

procedure PAYBILL
    GUI.Hide (savings_btn)
    GUI.Hide (checking_btn)
    GUI.Hide (quit_btn)
    GUI.Refresh
    removing1
end PAYBILL

procedure TRANSFER
    GUI.Hide (savings_btn)
    GUI.Hide (checking_btn)
    GUI.Hide (quit_btn)
    GUI.Refresh
    removing1
end TRANSFER

procedure SAVINGS
    GUI.Hide (savings_btn)
    GUI.Hide (checking_btn)
    GUI.Hide (quit_btn)
    GUI.Refresh
    withdraw_btn := GUI.CreateButton (10, 270, 60, "WITHDRAW", WITHDRAW)
    deposit_btn := GUI.CreateButton (10, 230, 60, "DEPOSIT", DEPOSIT)
    balance_btn := GUI.CreateButton (10, 190, 60, "BALANCE", BALANCE)
    paybill_btn := GUI.CreateButton (10, 150, 60, "PAY BILL", PAYBILL)
    transfer_btn := GUI.CreateButton (10, 110, 60, "TRANSFER ACCOUNT", TRANSFER)
    quit_btn := GUI.CreateButton (10, 70, 60, "QUIT", Quit)
end SAVINGS



procedure CHECKING
    GUI.Hide (savings_btn)
    GUI.Hide (checking_btn)
    GUI.Hide (quit_btn)
    GUI.Refresh
    withdraw_btn := GUI.CreateButton (10, 270, 60, "WITHDRAW", WITHDRAW)
    deposit_btn := GUI.CreateButton (10, 230, 60, "DEPOSIT", DEPOSIT)
    balance_btn := GUI.CreateButton (10, 190, 60, "BALANCE", BALANCE)
    paybill_btn := GUI.CreateButton (10, 150, 60, "PAY BILL", PAYBILL)
    transfer_btn := GUI.CreateButton (10, 110, 60, "TRANSFER ACCOUNT", TRANSFER)
    quit_btn := GUI.CreateButton (10, 70, 60, "QUIT", Quit)
end CHECKING


procedure TRANSACTION
    cls
    GUI.Hide (transaction_btn)
    GUI.Hide (mortgage_btn)
    GUI.Hide (mutual_fund_btn)
    GUI.Hide (quit_btn)
    GUI.Refresh
    savings_btn := GUI.CreateButton (10, 150, 60, "SAVINGS ACCOUNT", SAVINGS)
    checking_btn := GUI.CreateButton (10, 110, 60, "CHECKING ACCOUNT", CHECKING)
    quit_btn := GUI.CreateButton (10, 70, 60, "QUIT", Quit)
end TRANSACTION

procedure MORTGAGE
    cls
    GUI.Hide (transaction_btn)
    GUI.Hide (mortgage_btn)
    GUI.Hide (mutual_fund_btn)
    GUI.Hide (quit_btn)
    GUI.Refresh
    back_btn := GUI.CreateButton (10, 300, 60, "Return to main menu", back_main)
    quit_btn2 := GUI.CreateButton (10, 270, 60, "quit", Quit)
end MORTGAGE

procedure MUTUAL_FUND
    cls
    GUI.Hide (transaction_btn)
    GUI.Hide (mortgage_btn)
    GUI.Hide (mutual_fund_btn)
    GUI.Hide (quit_btn)
    GUI.Refresh
    back_btn := GUI.CreateButton (10, 300, 60, "Return to main menu", back_main)
    quit_btn2 := GUI.CreateButton (10, 270, 60, "quit", Quit)
end MUTUAL_FUND

procedure main
    locate (5, 5)
    put "MAIN MENU"
    transaction_btn := GUI.CreateButton (10, 190, 60, "BANKING TRANSACTION", TRANSACTION)
    mortgage_btn := GUI.CreateButton (10, 150, 60, "MORTGAGE CALCULATION", MORTGAGE)
    mutual_fund_btn := GUI.CreateButton (10, 110, 60, "MUTUAL FUND INFORMATION", MUTUAL_FUND)
    quit_btn := GUI.CreateButton (10, 70, 60, "QUIT", Quit)
end main

main
loop
    setscreen ("nooffscreenonly")
    exit when GUI.ProcessEvent
    setscreen ("offscreenonly")
end loop


Sponsor
Sponsor
Sponsor
sponsor
zomg




PostPosted: Fri Oct 15, 2004 10:54 am   Post subject: (No subject)

i have, as some would would say, a couple of stupid questions...
WTF is the point?!?!?! what does it supposed to do!?!?!!?? it serves no useful purpose in the existance of humanity AHHHHHHHHH!!!!!!!!11
TryinghArd_noob




PostPosted: Sun Oct 17, 2004 3:17 am   Post subject: (No subject)

Well.. i know im not good at this as u are, that's why im "TryingHard_noob"... but at least i tried ryt?!

my point was that i could go back to my main menu (that is GUI buttons) without using other windows... i just posted the basic program, and if u want it to work then u can modify it by adding other programs in it, so dat u could do commands and graphics...

u should have suggest something before...

man......... this u ever read my question?!... or ur jst lyk dat<!?
Hikaru79




PostPosted: Sun Oct 17, 2004 4:48 pm   Post subject: (No subject)

tryinghArd_noob, good for you! Smile You had a problem and even though nobody could solve it you didn't just sit around and whine, but you did it yourself! If only all noobs were like you Wink (Just joking, you no longer qualify as a n00b. You're cool now).

+10 Bits for you Smile
TryinghArd_noob




PostPosted: Tue Oct 19, 2004 12:02 pm   Post subject: (No subject)

Thanks 4 the generosity Very Happy

bits?! is that some kindda points or something?!

i guess being tryinghard sometimes paid off Laughing Laughing Laughing
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: