TreeBox sample





source ../../oo.tcl

@import core.*
@import gui.*

wm geometry . "300x200"

set box [TreeBox new] 
$box label: "This is a TreeBox widget"

$box root: "Main node"

foreach i {1 2 3 4} {
  if [catch {$box add: "Main node/node $i"} err] {
    puts stderr "$err"
  }
  foreach j {1 2 3} {
    if [catch {$box add: "Main node/node $i/subnode $j"} err] {
      puts stderr "$err"
    }
  }
}

$box onSelection: { puts stderr "selection is now $selection" }
$box onRightClick: { puts stderr "RIGHT_CLICK - selection:$selection" }
$box selection: "Main node/node 1/subnode 1"
$box show