Referencing Clones

I’m making a Facebook or Instagram-esque quiz app where posts are created at runtime. This is fine with the cloning blocks, however when there are interactive components such as upvote, downvote, etc., I can’t reference or make changes to the specific clone.

I know that there’s something coming soon where the properties of components can be copied, but are there any workarounds for now?

I was just going to post a thing similar to yours:

I’d like to clone entire rows or columns that have multiple buttons and label inside but I don’t think that it’s possible to have a reference to them in any way right now unless you copy and position alla of them one by one, which is not that crazy now that I think about it, but it’s way more work that there would be needed with for example a name component block,
Here’s the ending comment on a problem I’m having that would have made me use way many blocks.

@renren66, Can you describe in some more detail what problems you are having with referencing or making changes to a specific clone? You should be able to change or reference the properties of a clone by using the appropriate blocks in the Any Component drawer, i.e. these blocks:

08%20AM

Perhaps I am misunderstand the problem that you are having, though.

-Mark

@maxb You can get references to all the components in a row or column by using the 'all ... in ...' block, i.e.:

35%20AM

Just replace the 'Screen1` there with your row or column and the block will return a list of all the components in that row or column.

-Mark

This is the basic layout of the post. For example, what I want to do is to change the value of the label between the upvote and downvote buttons when the user clicks the corresponding button. However, as you can imagine, if there are multiple clones, I cannot reference the specific label to be changed.

I do know the workaround where the background picture/colour is referenced. But when the user clicks the upvote button, there is still no way reference the label next to it to make changes.

Is there a way to reference the parent column of the button maybe?

After creating a clone, you can get its UUID using the light green block “clone”. This means that you can refer to any clone after its creation.

1 Like

How exactly can I get the UUID?

This is the kind of thing you’re looking for, @renren66, right?

1 Like

Yes exactly

How does this work?

Here’s my approach to this @renren66

2 Likes

%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

1 Like

Thanks a lot

I think it’s unnecessarily technical and confusing to talk about UUIDs. I would prefer to think of it as the clone block actually returning the cloned component (or a reference to the component, if you want to get technical).

And just to be clear, while the clone block does use UUIDs, that should be considered an implementation detail and, in principle, could change.

-Mark

1 Like

Totally agree with you. The reference to the component sounds more understandable and universal.

1 Like

Wow @domhnallohanlon that’s pretty much mind blowing for me!

Kudos to you, I think I can totally use that, but, my design has the pattern:

Column

  • Button1
  • Row
    – label1
    – button2
    – label2
    – button3
    – label3

and I’m also thinking about taking the ‘cloning pattern’ from an online database, so the name of the labels, the bgr picture, will be taken from there.

Update: my database idea is working, super cool.
Next I’ll face what happens when a button is pressed, but I think I have it figured out.

Right now (off topic I kno) I really need some help understanding how to secure the firebase database and then I’ll be a very happy thunker :smiley:

I’ll start thinking if I can use your ideas :+1:

1 Like