Concept of 'Assign' in App Inventor

Hello everyone,

I would like to ask the community if the App Inventor programming language understands the 'concept' of Assign. Let me explain: I have an application with 24 buttons, and for each of them I have to set the relative text with a string. Currently I am forced to repeat 24 times the same part of code, in which ONLY the number of the button varies. It would be very useful to be able to 'assign' each button to a variable X, and therefore use only ONE code for all the buttons, using the Variable X.

Thanks

This is an example:

Use Any component

specifically Any Button
anyButton

or

image

Thanks!!! Now I try :slight_smile:

Hi,
Using Any Component works, but I need to know the NAME of the button was pressed... I haven't seen any command that gives me this.
Thanks!

Sample:

Use the position (index) of the component in a list of components.

Do you need the name of the button or do you need the text of the button which was pressed?
Fot the latter, there is an advanced get text of button component block available

Taifun

I need the Name of button, not the Text.
The AnyButton command snaps to all buttons, while I need to snap only to SOME buttons, so I need their Name (this is because the text of the buttons is not fixed).
thanks
Corrado

Make a list of the buttons you want to change, then test if button is in the list:

image

Thanks TIMAI2 !! It's work perfectly
Thank You!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.