How do i make to a button of a specific color to change to another color when a diferent button is presed

im kinda new on mit app inventor and im triying some programs could i have some help?

This is fairly trivial....

  1. Get the button click event of the second button
  2. Set the button colour of the first button in the second button click event
  3. If you want to switch back to the first colour, use an if/else condition block to test the colour of the first button, then change the colour as required.

image

the problem is that this script only will work for changing the color of other button but imhandling 10 buttons and if add this code it wont work only one button will work and if i extend it it would be really long could you try to meke it shorter?

Do you want to change the colour of all 10 buttons at the same time, to the same colour?

You would need generic blocks, and lists of button components.

Here is a sample ...

no just having the last cliked button of a color for example red and the rest of other color like dark gray

To be clear:

  1. You have 10 buttons
  2. You want when a button is clicked, that button changes colour (to red), and all other buttons change colour to (gray).
  3. You want this action for all 10 buttons.

Is this correct ?

yes

It would have saved everyone some time if you had asked this question in the first place !!

Here is how to do it:

image

If you want the "gray" buttons to be returned to the default button state, then use "0" instead of a colour

thank you but the thing is that i forgot to specifyit sry about that