Computer Science Canada Vending machine help |
Author: | seider [ Sat Nov 25, 2006 3:03 pm ] | ||
Post subject: | Vending machine help | ||
i want to make a vending machine and i have recenlty just started using turing and it is my first programming course and i want to make it so the user can quit/go back to the start when ever he want to, and i tryed useing the GUI exit bottom but i just couldnt get it to work. so plz can someone help me.
|
Author: | jamesonline [ Fri Dec 01, 2006 4:41 pm ] | ||
Post subject: | |||
hey you could do an if...then statement to give the user the option to quit put it anywhere - incorporate it into the first input as Q or at the end adding on a delay of a second or so ( delay (1000) )would help the program too for the line "exit when GUI.ProcessEvent, change it to:
As for the button, i couldnt help you, perhaps a menubar or move the button to the right an add scroll bars??? i dunno |
Author: | Hackmaster [ Fri Dec 08, 2006 10:23 pm ] | ||||
Post subject: | |||||
GUI is hard for people who have just started...it is simple enough, but It can blow some brains apart...i've seen it happen. it's a risk you take. the code to create a new button is simple. it is:
whoa! I could hear the brains exploding from here!... let me explain a bit. "var name : int:=" is basically giving the Button a name so you can talk to it later. the x, y, and width are where you want it and how wide you want it to be. it already has a predefined height. "text" is what you want the button to say.. in your case, "Quit" would probably be what you want. actionproc is the procedure you want the button to execute when it's pressed. in your case, you probably want it to quit, and GUI has a predefined function for it... in that space, put GUI.Quit, just like that. anyways... it looks like you've got all of that. I thought I would just explain for refrence. but, james is right... the problem here is with your GUI.ProcessEvent loop... but he already told you how to fix that. also... may I suggest something? please... for the love of god...don't do your if statements like that. bloody hell. You can barely read it! if you must have all those ORs, then please, please, space them better. the proper (readable) way to do this would probably be:
much more readable. |