Hey,
On 23 November 2010 19:44, Fritz Zaucker
<[email protected]<mailto:[email protected]>> wrote:
That would only make sense to me, if I would add the widgets again later on.
Is something like that done in the framework somewhere? Otherwise it would
perhaps even be possible to replace removeAll() by destroyAll()
My I veto that, please. :) I use removeAll() and re-use the
components in other places afterwards.
Totally agree. removeAll should never dispose the removed children.
To me, it sound like there is a confusion between destroyAll() and removeAll().
remove() and removeAl() should apply to a container and should remove the
widget from the container.
Nothing to do with reclaiming memory.
Removing and re-adding a widget is very common way to speed up GUI by reusing
widget instance.
destroy() sound like a destructor, isn'it ?
Exactly.
or have a removeAll with a destroy parameter.
I would second that though.
I don't understand the need to mix 2 different things : reclaiming the memory
and removing from container.
Why one would need to reclaim the memory with a remove ? In what case ?
Why not calling destroy on the rot container that in turn, internally, will
loop and call remove + destroy ?
Code and API should show the intention as much as possible, so :
If a qooxdoo user call remove or removeAll it mean only removing widget from
container. Remove should not make sense outside a container.
If a qooxdoo user call destroy or destroyAll it mean recovering memory,
destructing a widget instance and this will also need to cascade the destroy it
that widget is a container.
What I don't like at the whole idea that the container should destroy objects
he did not create. Usually, the object creating another objects is responsible
for destroying them. With that in mind, i think that a removeAll including a
destroy all could be done in the client code with a couple of lines:
var children = container.getChildren();
container.removeAll();
qx.util.DisposeUtil.disposeArray(children);
But i have to admit that removeAll should return an array containing all
returned children. That would make it to a single line of code.
qx.util.DisposeUtil.disposeArray(container.removeAll());
What do you think about such a solution? That way, the dispose is kept at its
place and its still a pretty nice API.
Best,
Martin
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel