Hi,
I’m using an “any button click” block to trigger a button press from a cloned row.
I want to change the background color of the row where the button is placed but I can’t find out how.
I search for something like:
“Set the background color to RED of the ROW that conain the pressed button.”
I’m starting with this but obviously is wrong.
Even if I don’t like so much to check every element to know the owner. At the moment is not a problem 'cause I have only few rows, but If the number of rows get bigger and I have to change the status of the last one it could take a while to apply changes.
Make a list of ‘all row in column’. Then make a list of the first button in each column. Use the ‘find in list’ to find the button’s list position, then use that list position to get the row’s component ID using a list block.
Oh, wait. If you need to loop through every row to change the color /anyway/, you probably aren’t going to gain time by finding the right row with list blocks.
Actually, I bet you don’t need to change color on all those rows. You only need to change ONE row back to white. You could set a variable to that row’s ID on the previous pass, and just change it.
If you’re checking performance on a slower device, wait until it finishes cloning first. It takes my 2016 iPhone /forever/ to finish.
I added timing for both approaches. If you click a label, it iterates through them. For 100 rows (slow iPhone/Live) with iterating (click the label), ~500ms. For 100 rows (same conditions but using list functions - click a button): ~20 ms. Your results will vary (your phone might be faster), but that’s a noticeable difference with 100 rows.
Got a list with 5 rows? Do whatever you want. It probably doesn’t matter much.
The truth is that I was unaware of the existence of the clone method but I am going to test it in a solution that I am working on because I am having speed problems.
Very interesting your functions that are giving me new ideas.
I use a screen with 10 rows designed that I hide / show / fill depending on the amount of data and current page, with controls put in lists stored in memory and using functions with indexes to fill them directly.
I don’t know if my system works better … but I have to give it a try