Tuesday, July 03, 2012

Setting tree/list column header widget

Just added a new option to the gnocl::tree/gnocl::list columnConfigure sub-command to allow embedded widgets.

#---------------
# test-columnWidget.tcl
#---------------
#!/bin/sh
#\
exec tclsh "$0" "$@"

package require Gnocl

set tree [gnocl::tree \
    -types {string integer} \
    -titles {"" "# of Legs"}]

$tree add {} {Mamals Birds Bugs}
$tree add 0 {{Cat 4} {Dog 4} {Human 2}}
 

foreach {paro pred} [$tree add 1 {Parrots Predator}] {}
 

$tree add $paro {{Cockatoo 2} {Amazone 2}}
$tree add $pred {{Hawk 2} {Eagle 2}}

$tree expand \
    -path "1" \
    -recursive 1

gnocl::window \
    -title "Tree" \
    -child $tree \
    -defaultWidth 300 \


set but(1) [gnocl::button -text HIDIHI]
$tree columnConfigure 1 -widget $but(1)

No comments: