# Identify container of an object

**URL:** <https://community.thunkable.com/t/identify-container-of-an-object/1295355>\
**Category:** Questions about Thunkable X\
**Tags:** list, any-component\
**Created:** [May 20, 2021, 7:55am UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355 "2021-05-20T07:55:48Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giuseppe\_Geppo\_Catta](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Giuseppe\_Geppo\_Catta](https://community.thunkable.com/u/Giuseppe_Geppo_Catta)\
**Post date:** [May 20, 2021, 7:55am UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/1 "2021-05-20T07:55:48Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/d/fd7ad59b9238a915ab17960343ae063875b547c8.png)  
Thank you

---

<div class="post-metadata">

**Author:** ![jane](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jane/32/27575_2.png) [@jane](https://community.thunkable.com/u/jane)\
**Post date:** [May 20, 2021, 8:06am UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/2 "2021-05-20T08:06:05Z")

</div>

Hi there,

What you’ll need to do is:

- For each Column on your Screen, check if this Column contains your Button
- If it does, change this Column’s background color

You can see blocks to do this in this screenshot, and a demo project [here](https://x.thunkable.com/projectPage/60a6172769e8510011d45f82/).

 ![Screen Shot 2021-05-20 at 9.02.41 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/a/fad243943febaf36d13f0ad9042a18719f43c378.png)

Let me know if you have any questions about how this works!

---

<div class="post-metadata">

**Author:** ![Giuseppe\_Geppo\_Catta](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Giuseppe\_Geppo\_Catta](https://community.thunkable.com/u/Giuseppe_Geppo_Catta)\
**Post date:** [May 20, 2021, 8:34am UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/3 "2021-05-20T08:34:56Z")

</div>

So, no way without polling every element?  
No way to know the “owner” of an object?

---

<div class="post-metadata">

**Author:** ![Giuseppe\_Geppo\_Catta](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Giuseppe\_Geppo\_Catta](https://community.thunkable.com/u/Giuseppe_Geppo_Catta)\
**Post date:** [May 20, 2021, 8:49am UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/4 "2021-05-20T08:49:07Z")

</div>

This is my final solution:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/2/526e872d1033cedeb268a2178f2571f376a36141.png)  
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.

---

<div class="post-metadata">

**Author:** ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)\
**Post date:** [May 20, 2021, 2:23pm UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/5 "2021-05-20T14:23:01Z")

</div>

An alternate approach that /might/ be faster.

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.

---

<div class="post-metadata">

**Author:** ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)\
**Post date:** [May 20, 2021, 2:24pm UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/6 "2021-05-20T14:24:59Z")

</div>

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.

I’m betting that’s going to be faster.

Here’s a demo project - waiting for 100 rows to clone is painfully slow (not related to my solution), but then the response to button pressing is fast.  
[https://x.thunkable.com/copy/bb5318a12f8cc3df4de693190f0c5782](https://x.thunkable.com/copy/bb5318a12f8cc3df4de693190f0c5782)

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.

SLOW:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/6/86f775f01a603e370d61a2bab15479e05af33ee8.png)

FAST:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/5/05a888018de42d78c7f687707d335e8c82d48bb6.png)

Setup to go fast:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/a/faeffd75bc9fd07d57b04ab70626148662e2da96.png)

I tested on web view also (fast computer). List functions ~1ms, iterate ~50ms.

---

<div class="post-metadata">

**Author:** ![pesajejar](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pesajejar](https://community.thunkable.com/u/pesajejar)\
**Post date:** [May 20, 2021, 3:31pm UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/7 "2021-05-20T15:31:07Z")

</div>

Take note.

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.

---

<div class="post-metadata">

**Author:** ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)\
**Post date:** [May 20, 2021, 3:34pm UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/8 "2021-05-20T15:34:02Z")

</div>

Cloning is probably not a solution to a speed problem. 🙂

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [May 20, 2021, 3:37pm UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/9 "2021-05-20T15:37:44Z")

</div>

Can we put that on the Thunkable quote board, if there is one? 😁

---

<div class="post-metadata">

**Author:** ![pesajejar](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pesajejar](https://community.thunkable.com/u/pesajejar)\
**Post date:** [May 20, 2021, 3:41pm UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/10 "2021-05-20T15:41:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [May 20, 2021, 4:42pm UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/11 "2021-05-20T16:42:13Z")

</div>

If there is one, the most popular quote would be ‘Please do not reply to a post that is 2 years old!’

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:22pm UTC](https://community.thunkable.com/t/identify-container-of-an-object/1295355/12 "2024-11-08T13:22:24Z")

</div>


