Hi Community,
I made a project as photos below, when click the buttons, they change the colors, and when clicked the "Recover" button, they changed back to grey color. But my question is that, my project has many items or buttons, maybe 40-50, it would spent me much time to set the blocks.
Can I set the blocks more simple using "Variables" and "Lists"? And how to set the blocks?
Thank you for anyone can help !
In such case don't use native components better use dynamic buttons along with any button clicked event.
So that it will turn color change only on the clicked button leaving others to original color
Init a global list of button components Button1....Button4
In Btn_Recover loop over that list using the generic (Any Button) blocks to set text and background color for the current item in the for each loop.
For the 4 Button.Click events, take one of them and right click it to make it generic.
Also change the enclosed color changing blocks to generic.
Have the When Any Button Click event check if its component is in the aforesaid global list of components. If so, change the component's colors using the enclosed generic blocks.
You won't need the other 3 Button Click events. Remove them.
Hi ABG,
Your answer to my question is really what I want to know, now i can do my project easily.
Thank you very much !
Eric Pang
Also see some list based approaches ...
These are simpler and more extensible, but not as pretty.