Use anybuttom longpress to change an image

Hi everybody, I'm asking for help to do the follow:

I have 5 buttoms with a random text number on them, and the numbers are related to an image with .jpg format.

What I'm trying to do, is that an image component shows the image corresponding to the number on the pressed buttom; I already did, using longpress an touchup elements of each buttom, which means that I repeat code for each of them; I wonder if there's a way to do it using anybuttom funtion, because I don't find out how.

Thank you in advance for your help.

For just 5 buttons and 5 images, you would need to init a pair of matched global lists, one of the buttons and the other of the images components.

You can use membership tests of the component triggering the generic event against the various list, or index tests.

You can also test the .Text of the button.

Here are some sample projects that use generic events:

Thank you, @ABG Abraham, I'll check it.

@ABG, thank you very much for your comments and examples, it works great, and finally I understood how this kind of components work.

Regards.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.