Can I use forloop to remove all children of wrapbox?

Check if the index is correct using a print node.

At first, I added some text widgets to a wrap box, then I want to remove all the text widgets and add other text widgets. But it seems useless. I can’t remove the first widgets via using a change function. Is there something wrong?

Remove the index from the for loop to the remove child. You need to always remove the child at Index 0.

3 Examples for clearing children.

271836-wrapboxclearchildren.png

2

3

Hi,
you could also use the “Clear Children” note. To remove all children

I knew clear, but why I can’t use forloop to remove all the children of my wrapbox?

You can, your logic is wrong, see my answer above.

Lets say you have a Wrap Widget with 3 children.
You are currently looping through 3 items and removing the item at that index.

Loop iteration 1:
Remove object at index 0 (2 items remain)

Loop iteration 2:
Remove object at index 1 (1 item remains)

Loop iteration 3:
Remove object at index 2 = Error: Accessed none trying get hold of the 3rd child of the wrap box, because only 1 remains.

Remove your link from the index of the loop to the child index, so you are removing index 0 every time, and you should be fine.

I see. You’re right. Thx a lot.

No problem. Would you mind marking my first answer as the solution so other people with the same problem can find it?

Thanks.

Ok,on problem.

Great information thank you so much for this wonderful information… krogerfeedback

Thank you for every other excellent post. Where else could anyone get that type of info in such a perfect approach of writing? I’ve a presentation next week, and I’m at the search for such information.tellthebell