declare [Tree QTk]={ModuleLink ['x-ozlib://anders/strasheela/Prototyper/grolaux-tree-1.0/Tree.ozf' 'x-oz://system/wp/QTk.ozf']} declare TreeNode=Tree.treeNode C {{QTk.build td(canvas(glue:nswe handle:C tdscrollbar:true lrscrollbar:true))} show} %% class CustomNode from TreeNode feat calc current:{NewCell unit} meth init(...)=M TreeNode,M {self bind(event:"<1>" action:self#selectNode)} end meth selectNode if {Access self.current}\=unit then {{Access self.current} select(state:false)} end {Assign self.current self} {self select(state:true)} if {Access self.current}==self then {self switch} end end meth expand(...)=M if {IsFree self.calc} then Label={self get(label:$)} in {self addLeaf( nodes:{List.map ["a" "b" "c" "d"] fun{$ C} {New CustomNode init(parent:self label:Label#" "#C)} end})} self.calc=unit end TreeNode,M end end CurrentNode={NewCell unit} RootNode={New CustomNode init(canvas:C font:"Helvetica 10" height:18 label:"Node" )} {RootNode draw(x:2 y:2 height:_)} {RootNode expand}