[SOLVED] Handling Click Events for Dynamically Cloned Buttons

Hi,
I’m currently working on a project involving aerodrome charts based on runways. The number of runways varies from airport to airport, so I am dynamically cloning a runway button for each runway. However, I’m having trouble registering click events for these cloned buttons and changing their background color upon click.

Here’s what I’m trying to achieve:

  • Clone a button for each runway dynamically. (which i have figured out)
  • When a cloned button is clicked, its background color should change to black and the other cloned buttons and the original button should change to a different background color
    Here’s what i have tried

Instead of using for all items in list of clone items …

you should use if the clicked item is in the list logic

Hello @longcodes22kpn5
It seems to be an issue with the “Any Component” block.
We will flag it to our engineering team and will provide an update as soon as possible.
Thank you for your time and patience in this matter.

1 Like

thank you!

Hi there,

I have a similar problem. Example:

  • I create some buttons with the purple block “clone …” and set the text of each button to a different text
  • when running the app (preview, live on iOS, live on Android) the buttons have the correct texts
  • inside the yellow block “when Any button Click…” → green block “Button component text” gives the same text for each button.
  • an older thunkable app (which used to work correctly) shows the same kind of error.

I hope this description is clear enough…

PS: I work with Snap to Place

Hi hope this helps, been having the same issue and I think the bug is a combination of the cloning and the any button click. I have been able to reproduce the bug in snap to place and drag and drop but do have a work around for both. In snap to place, put the button you want to clone in a row or column and then clone that row/column not the button. The cloned columns will then all have the same id, but the buttons inside will all have individual id’s. In drag and drop you can do the same by using a container with a button in and cloning the container

1 Like

Hello
We have successfully identified the root cause and created a solution. Currently, we are in the process of testing it and working on a plan to release it in production, ensuring that everything will function as usual.
We will provide an update as soon as possible.

Hello @longcodes22kpn5 @tiny_apps @thecodeloft @Michael_Rogulla
I would like to let you know that we have now officially released a fix for this bug.
Please keep in mind that you may need to do a hard refresh of your browser for the changes to take effect in your project.
If your downloaded or published app is affected by any of these issues, you will need to re-download or re-publish your app for these changes to take effect.

Unfortunately, the update for the Thunkable Live app is not published yet so it will not work if you test it using Thunkable Live app but we will let you know when the new version is published.

2 Likes

thank you for your support

1 Like