View · Search · Index
No registered users in community xowiki
in last 10 minutes

Re: [Xotcl] Ordering of Children

From: Neophytos Demetriou <k2pts_at_phigita.net>
Date: Thu, 02 Feb 2006 19:47:48 +0000

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