Dear Krzysztof,
You might consider the OrderedComposite class from OpenACS:
http://cvs.openacs.org/browse/OpenACS/openacs-4/packages/xotcl-core/tcl/20-O...
It preserves the original definition order (via method children) and it supports optionally sorting. The OrderedComposite has as well a "contains" method.
-gustaf neumann
Am 12.01.11 14:00, schrieb Krzysztof Frukacz:
Hello,
I would like to use the children mechanism for my classes. When I create a class (lets call it B) I use -contains {...} and list other objects. But in init proc of B I also use this: eval C new -childof [self]. I am interested in the order that children are listed. I need it to be fixed. I noticed that first goes the child from init of class B, then the ones that I add using -contains (outside the init proc).
Is this order fixed? (first children created in superclesses, then ones from cunstructor, then ones from -contains). Also: is the order used in -contains fixed? Will I always get children in the same order that I added them?
Best Regards,