Hi,
Hopefully a simple question.
I'm building a tree view controller and am seeing an unexpected ordering issue. I add with;
MemoryLineController instproc init {} { my AddNode "File Diagnostics" my AddNode "Real time Diagnostics" my AddNode "Graphs" my AddNode "Post-Processing" }
MemoryLineController instproc CreateTreeview {} {
set counter 1 foreach childNode [my info children *gNode*] { $childNode BuildTreeNode [my tree] $counter incr counter } }
MemoryLineController instproc AddNode {name} { eval GUINode [self]::[my autoname gNode%02d] -DisplayName {$name} }
So the init method adds my root level nodes The order I get out is; Post-Processing File Diagnostics Real time Diagnostics Graphs i.e. the last is displayed first and then the next 3 in order. Why is this and what is the best way to correct it?
thanks Matthew
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
Thanks - I'll give that a go.
Matthew
-----Original Message----- From: xotcl-bounces@alice.wu-wien.ac.at [mailto:xotcl-bounces@alice.wu-wien.ac.at]On Behalf Of Neophytos Demetriou Sent: 02 February 2006 19:48 To: xotcl@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@alice.wu-wien.ac.at http://alice.wu-wien.ac.at/mailman/listinfo/xotcl