Computer Science Canada GUI Button Creation |
Author: | Bman54 [ Fri Nov 13, 2009 11:26 am ] |
Post subject: | GUI Button Creation |
I really want to know how to create a GUI button. I've tried using code from another topic on this site but there was a bunch of errors that I have no idea how to fix. Then I tried using code from the Turing Help section and that still didn't work. Most of the problems come from the Syntax code at the top. Can someone just give me exactly the code used to create a button so I can create one? Please and thank you. ![]() |
Author: | efan41 [ Fri Nov 13, 2009 2:12 pm ] |
Post subject: | Re: GUI Button Creation |
Try something like this: var my_gui_button :int blah blah blah (whatever text you have until you actually need the button) my_gui_button:= GUI.CreateButton (x,y,width,"what you want to appear on the button", procedure you are calling) And there you go, you have a GUI button. A couple things you should note though,you need to know how to make a procedure first, because if you don't you have no reason for a GUI button.The procedure must be before the GUI button, because the computer reads the text from top to bottom, not in full, so if it sees the GUI button but dosen't recognize the procedure you are calling with that button, it will desplay an error. Also, if you replace width by 0, the button will automatically size itself to the text written on it. Ex: Lets say I want to make a GUI button for the coordinates (40,100)*these would be the coordinates for the bottom left corner of the button* and I want it to say START on it, and I want it to call the begin procedure, then it would look something like this. my_gui_button:= GUI.CreateButton (40,100,0,"START", begin) hope this helps ![]() |
Author: | Megaman_Zero [ Fri Nov 13, 2009 2:25 pm ] |
Post subject: | Re: GUI Button Creation |
And something that efan forgot to mention: Before you try to make GUI buttons, make sure that you have near the top "import GUI" and it has to be before you declare your variables. Otherwise, you wouldn't be able to run the program if it isn't there. ex.: import GUI var something : int var else : int Rest of program ----------------------------------- Something like that. |