Hi,
I got several labels and timers in my UI, e.g. label0 and timer0, label1 and timer1. Each of these pairs have a button (button0, button1), I got 10 of these in total.
The user is supposed to press the first button and it will change the label and start the timer. Then he is supposed to press the next button. Then the same will happen to the next label and timer and so on.
I’ve been searching here and on the web for days but cannot wrap my head around how to avoid code duplication and instead reference thes label and timer elements.
In the image above this would work but I would have to duplicate this 10 times. I was thinking of using “when any Button.Click” but then I have no idea how to reference the label and timer elements of that respective button that was pressed. I can only reference which button was clicked this way and I don’t think using 10 “if button X was clicked then change label and timer X” is any better.
What is the right approach to use here?