[Xotcl] Ordering of Children

Matthew Dodwell mjd at orcaspirit.co.uk
Fri Feb 3 12:21:11 CET 2006


Thanks - I'll give that a go.

Matthew

-----Original Message-----
From: xotcl-bounces at alice.wu-wien.ac.at
[mailto:xotcl-bounces at alice.wu-wien.ac.at]On Behalf Of Neophytos
Demetriou
Sent: 02 February 2006 19:48
To: xotcl at alice.wu-wien.ac.at
Subject: Re: [Xotcl] Ordering of Children


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
_______________________________________________
Xotcl mailing list
Xotcl at alice.wu-wien.ac.at
http://alice.wu-wien.ac.at/mailman/listinfo/xotcl


More information about the Xotcl mailing list