Game Development Community

Get Gui Name

by Eric Schwegler · in Torque Game Builder · 11/21/2006 (3:21 am) · 4 replies

Hi,

is there a way to get the Gui's name that was clicked?

For example, if there are four buttons, and all lead to the same function, but the behaviour of the function depends on which Button was pressed, how can I get the Name of the Button that called the function?

greetz

#1
11/21/2006 (3:31 am)
Not to sound silly, but why not just have them call separate functions?
#2
11/21/2006 (7:05 am)
The Idea is the following :

For Player 1 - 4, theres an Arrow you can Click on, now if you click on it, it changes a Bitmap besides the Arrow. Of Course it could be made with four functions, but the only difference is the Bitmap that gets changed. (ie. Arrow 1 -> Bitmap1 , Arrow 2 -> Bitmap 2, etc.)

So I thought it would be nice to have just one function, since it does exactly the same thing for every Arrow thats clicked and its corresponding Bitmap.
#3
11/21/2006 (2:20 pm)
You could make the button pass in a parameter when it calls the function.
#4
11/21/2006 (10:16 pm)
Ah, yes, Thank you! that works allright. I guess I was a little fixed on the Gui's Name :)