Computer Science Canada how to use my own image as a button? |
Author: | sakurasan1122 [ Tue Jan 08, 2008 4:05 pm ] |
Post subject: | how to use my own image as a button? |
so lets say i made a button in photoshop or something. Instead of using those grey turing buttons, how could i use my image as the button? |
Author: | Tony [ Tue Jan 08, 2008 4:37 pm ] |
Post subject: | RE:how to use my own image as a button? |
this depends on what kind of functionality you want our of your button. Does it have to act as the rest of GUI module, or is this stand-alone? |
Author: | sakurasan1122 [ Tue Jan 08, 2008 4:42 pm ] |
Post subject: | RE:how to use my own image as a button? |
Well the buttons just going to have its own process, i already had the code but that only makes the plain grey button and i want to use my own image as a button |
Author: | Nick [ Tue Jan 08, 2008 4:51 pm ] |
Post subject: | RE:how to use my own image as a button? |
well yoou can a:use turing's GUI the syntax is GUI.CreatePicture ( x, y, picture : int, mergePic : boolean ) : int or b: create your own button with Pic.Draw and Mouse.Where |
Author: | Tony [ Tue Jan 08, 2008 5:03 pm ] |
Post subject: | RE:how to use my own image as a button? |
GUI.CreatePicture doesn't respond to clicks, but if you overlay the picture over your grey button, the latter might still trigger. If you have just one button, Mouse.Where is simpler than having to deal with the GUI module. |
Author: | sakurasan1122 [ Tue Jan 08, 2008 5:05 pm ] | ||
Post subject: | Re: how to use my own image as a button? | ||
lets say i have a .jpg image that i want to be my button, how would i code that? currently im using something like this: i still want the button to perform a process though
|
Author: | Tony [ Tue Jan 08, 2008 7:59 pm ] |
Post subject: | RE:how to use my own image as a button? |
instead of the exit when GUI.ProcessEvent loop, you have one with Mouse.Where that checks if the mouse has been clicked and it's located over your image. If the conditions are met, you call the procedure. If you want to have two buttons, you would need two such if statements. The GUI module does all of that, and abstracts it away from your view, but as a result it is very inflexible. |