WJG (22/05/09) The gnocl::tree widget has been around some time but recent changes have included the ability to toggle the display of row highlighting and tree lines which are not properties of the GtkWidget but part of the current theme. Fiddling with GtkWidget styles is a messy process so its usally best avoided or, as in the case of Gnocl, the messy work is already done and under tight control.

WJG (09/12/09) The gnocl::tree switch -reorderable switch has now been set to 1 to enable interactive moving of tree rows.

Here's an updated version of the demo script with the recent enhancements:

And the script that created it.

# Author:   William J Giddings
# Date:     07/05/09
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

package require Gnocl

# create the widget
set tree [gnocl::tree \
    -types {string integer} \
    -titles {"Beastie" "Number of Legs"} \
    -ruleHint 1 \
    -treeLines 1 \
    -reorderable 1 \

# add some rows
$tree add {} {Mamals Birds Bugs}

# add branches to entry 0, ie mammals
$tree add 0 {{Cat 4} {Dog 4} {Human 2}}

# add a couple of branches to entry 1, and stor entry ids
foreach {paro pred} [$tree add 1 {Parrots Predator}] break

# add some sub-brances
$tree add $paro {{Cockatoo 2} {Amazone 2}}
$tree add $pred {{Hawk 2} {Eagle 2}}

# selectively change viewing options
$tree expand -path "1" -recursive 1

gnocl::window -title "gnocl::tree" -child $tree -defaultWidth 300 -defaultHeight 300