[Xotcl] Ordering of Children

Neophytos Demetriou k2pts at phigita.net
Thu Feb 2 20:47:48 CET 2006


Matthew Dodwell wrote:
> MemoryLineController instproc AddNode {name} {
>     eval GUINode [self]::[my autoname gNode%02d] -DisplayName {$name}
> }

* Replace the body of addNode as follows:

	my lappend __children [eval GUINode ...etc... ]

    and [my info children *gNode*] in CreateTreeview as follows:

	[my set __children]

OR

* Use an OrderedComposite class that does it for you. You will either 
have to mix it in or define it as one of the superclasses of 
MemoryLineController, i.e.:

	Class MemoryLineController -superclass OrderedComposite


Class OrderedComposite

OrderedComposite instproc children {} {
   set children [expr {[my exists __children] ? [my set __children] : ""}]
   return $children
}
OrderedComposite instproc add obj {
   my lappend __children $obj
   $obj set __parent [self]
}


Best,
Neophytos


More information about the Xotcl mailing list