How do I change the background colour for a lot of buttons at once?

Hi all, I have a question to make my app smaller because now I can't open anymore, always error code from server.
I think the problem is that I have 100 buttons and when one of the buttons is clicked, the background of this one goes to yellow and all the other buttons' background to grey, so for 100 button, 100 lines to do.
Is there a more simple solution to do this that I don't need to put 100 x 100 lines, like a list or something?
Can someone help me and tell me how to do, maybe with an example?

Many thanks guys.
Koen

Use a dynamic button. :grin:

You need to keep your 100 button component blocks in a list or list of lists (table).
You will also need to use the Generic (Any) blocks and list select item blocks.

Here are some sample projects ...

The Eight Queens puzzle (Gallery)

button chess board over CloudDB, no rules

P.S. None of these samples require extensions. They are pure AI2 blocks based.

We are not on kodular...
Dynamic buttons are only on kodular and other distributions of app inventor.
I recommend you to put all your buttons in a list and then use a for each item/button in list block

You do not have to be to use the dynamic components extension...

Right, you can use the extension, but there's no built-in component here. @Koen_Vermeulen may be not likely to use extensions...

no-one else mentioned built-in components....

Try this: create100Buttons.aia (42.8 KB)

3 Likes

Hello, why don’t you put all your buttons on a gray background and you change the background to yellow with just one button. And when you click on another button it is this one that passes in yellow background and the precedent in gray background. it would only make two lines.