Renaming isn't... real? Problem with any component blocks

As a temporary solution, you can try the following trick: assign the button name to the TextColor or BackgroundColor or BackgroundPicture property, and when you click on the buttons, use the values ​​of these properties as the names of the buttons.

But when the user clicks the button called “Jhon”, how does the app know that the button pressed was Jhon and not Jane?

What I need is that I will insert the button’s name in a list that the user will see, so it has to be THAT EXACT name, I think I can create a workaround and have the same result but I also think that it could be done by the developers with not too much effort, to let me use the button’s name I mean, or at least I hope.

@maxb I think I understand what you’re trying to do and it makes sense to me. There are a couple of upcoming features that should help you. One is a block which would return the name of a component. That would, presumably, let you do exactly what you described. The other is the ability to add your own properties to a component, so you could, for instance, add a food property on your buttons which could have a value of “pizza” or “hamburger”. That would allow you to name your buttons whatever you like but still distinguish them. It would also allow you to distinguish buttons (or other components) that you create dynamically via the Create or Clone blocks.

What @actech was describing was a way to work around the fact that the features I mentioned don’t exist yet. For example, if you set the TextColor property of your buttons to have the same value as your button’s name, you can use that property to distinguish your buttons. It works because invalid TextColor values don’t have any effect on the color but they are saved with the component. If you happen to want to actually use the TextColor property to change your button’s text color then you can use the BackgroundColor or BackgroundPicture property instead. Note that I can’t guarantee that invalid values will always work this way (e.g. we might decide that they are an error), so I would suggest that if you use this workaround that you create a function (called, say, “GetButtonName”) which takes a button component and returns the button’s name. For now, that function would return the value of the TextColor property of the button, but you could change it to return the actual name once that block is available.

Hope this helps.

-Mark

1 Like

Thanks for the answer and everything,

could you tell me if the name component is gonna follow soon or it’s gonna take a while?

I ask so that I can decide if I should just wait for it or go back or use the workaround.

Thanks for the answer if there will be ^^

I think it’s going to take a little while.

-Mark