How to obtain the name of a button dynamically?

It's okay :grin:

Uh, oh... it's time to work for me... :open_mouth:

Thanks a lot to all of you, I'll tell you the tests results tomorrow.

Happy weekend! :wave:

In which case, why not try something like this:

Make a list of lists for each button and corresponding image
In the AnyButtonClicked event, test and then set the image

You also wanted to be able to toggle some buttons, this is how to change the text on each click

you can do the same with button images....

I'm Sorry @TIMAI2 , I already explained that to him before. :grin:

So you did...

1 Like

I'm so confused, just forget it :joy: :rofl: :pray:

Hi, all!
I tested the codes you suggested to me yesterday and they work fine, some of them in one way and the others in other, so I'll do use of them, it's sure. But the best thing, and I am very happy for this, is that I've learned a lot with all of you.
Anyway, after the experience adquired I think the final conclussion about my question is simple: it is not possible to obtain the name of a button dinamically. Right?
Thanks for all and have a very happy Saturday,

Do you only want the name of buttons, or any component?
The simplest idea is to make a list of list each list containing the Appinventor name of the component and the text string name of the component.

Then, it becomes easier to retrieve the text string of the component!

Good morning, Alaqmar_Bohori,
In my case, only buttons, so I'm going to edit my last comment.
All the best,

Now I confirm do you only wish to get the text string of the button:
Eg: If Button1 is clicked a label's text should be printed as Button1?

Not exactly, what I need is assign to a variable the name assigned to a button in the Components list (in the example, btn_station_number_1, btn_station_number_2 and btn_station_number_3) when I click it.

image

Then isn't that your answer? I am storing the name of the button clicked in a variable. Thereafter you can use the name of the button wherever you like

There is just a small error which i have corrected -
image

Both 'b's will be in capital

Don't worry, I understand... :blush:

Yes, I see it, but I'm looking for the way that I said, assign to a variable the name assigned to a button in the Components list, and that is what I think is not possible

That's the way..........................
I don't think you will get the name of a button anyother way unless the text of button and the component name match

Exactly, and for this reason the only solution that I can see is, as I said before, set the Button.TextColor=none, I don't like it, but I think that is the only way

Text Color?
They would be in RGB format I guess :thinking:

image

image

Then you won't be comfortable with this too, will you?

Well... the truth is... I like it! I think it's a good idea and I see more possibilities, but you answered my question before:

:wink: