Friday, May 24, 2013

colorear renglones en tablelist

package require tablelist
console show

set tbl .tbl
tablelist::tablelist $tbl \
 -columns {0 "A" 0 "B" 0 "C" 0 "D" 0 "E"}\
 -height 15\
 -width 100
pack $tbl

$tbl insert end [list a b c d e]
$tbl cellconfigure end,0 -foreground white -background red

$tbl insert end [list a b c d e]
$tbl cellconfigure end,1 -foreground white -background blue

$tbl insert end [list a b c d e]
$tbl cellconfigure end,2 -foreground black -background green

$tbl insert end [list a b c d e]
$tbl rowconfigure end -foreground black -background green


Interaccion dinĂ¡mica:
Habiendo seleccionado el cuarto renglon (row 3 debido a que la numeracion empieza en cero)
% $tbl curselection
3
% set fileSize [$tbl cellcget 3,1 -text]
b
% set fileSize [$tbl cellcget [$tbl curselection],1 -text]
b

Si a la 2a columna se le asigna un nombre (column 1)
% $tbl columnconfigure 1 -name fileName
% set fileSize [$tbl cellcget [$tbl curselection],fileName -text]
b