I'm making a ScrollArea layer which needs to update its content frequently. I find that there is no function to remove all of children of the scrollarea and layer in general. My workaround way is removing the layer (which can remove its children too) and recreate a new one then add the new content to it, but this way is too long.
Thanks for your helping.
Is there any efficient way to clear all children of a layer/ScrollArea?
-
-
Hi, my solution is to set a property for all elements inside scrollarea, example group=scrollingobj
Then, adapting a solution from this forum, remove all layers whith group=scrollingobj -
Hi, my solution is to set a property for all elements inside scrollarea, example group=scrollingobj
Then, adapting a solution from this forum, remove all layers whith group=scrollingobjThanks! It seems like there is no better way to do this.
-
Hi,
two options here:
Codefor(set(i,0), i LT layer.count, inc(i), if(layer[get(i)].grupo == scrollingobj, removelayer(get(layer[get(i)].name), true); dec(i); ); );
or
Codefor(sub(i,layer.count,1), i GE 0, dec(i), if(layer[get(i)].grupo == scrollingobj, removelayer(get(layer[get(i)].name), true); ); );
Hope it helps
Tuur -
cant you just removelayer() with children?
or do you want to keep the scroll layer container ?instead of setting a marker
you can also traverse all layers and check for the parent -
Zitat
instead of setting a marker
you can also traverse all layers and check for the parentIn some cases that could work as well of course
.. but then it will delete all with the same parent, which could not be ideal in all cases.double quotes??
Tuur
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!