• tablelist 7.11: background colors while disabled

    From Ralf Fassel@ralfixx@gmx.de to comp.lang.tcl on Fri Sep 25 12:38:44 2026
    From Newsgroup: comp.lang.tcl

    tablelist 7.11, tcl/tk 8.6.18

    During some longer processing, I would like to have a tablelist disabled
    (no interactions while processing), but indicate which row is processed
    by blinking some cell or row in the tablelist:

    wm geometry . 800x600
    package require tablelist
    tablelist::tablelist .t \
    -columns {0 One c 0 Two c 0 Three c}

    pack .t -fill both -expand yes
    .t insert end \
    {1 foo ""} \
    {2 bar ""} \
    {3 baz ""}

    proc progress {state count row} {
    puts "progress $state $count $row"
    .t configure -state $state
    incr count -1
    if {$count < 0} {
    set count 10
    incr row
    }
    if {$row < [.t rowcount]} {
    .t cellconfigure $row,1 -background [expr {$count % 2 ? "green1" : "white"}]
    after 500 [list progress $state $count $row]
    } else {
    puts "done"
    }
    }
    progress normal 10 0

    This changes the background of the second cell in each row while
    processing.

    However, with state 'disabled'

    progress disabled 10 0

    the color change does not happen.

    While this is documented behaviour for tablelist, I would still like to
    have some means to indicate the row being currently processed.

    Apart from embedding some labels or other widgets, any other ideas?
    Would a state 'readonly' (like in comboboxes) be feasible?

    TNX
    R'
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From nemethi@csaba.nemethi@t-online.de to comp.lang.tcl on Sat Sep 26 15:45:23 2026
    From Newsgroup: comp.lang.tcl

    Am 25.09.26 um 12:38 schrieb Ralf Fassel:
    tablelist 7.11, tcl/tk 8.6.18

    During some longer processing, I would like to have a tablelist disabled
    (no interactions while processing), but indicate which row is processed
    by blinking some cell or row in the tablelist:

    wm geometry . 800x600
    package require tablelist
    tablelist::tablelist .t \
    -columns {0 One c 0 Two c 0 Three c}

    pack .t -fill both -expand yes
    .t insert end \
    {1 foo ""} \
    {2 bar ""} \
    {3 baz ""}

    proc progress {state count row} {
    puts "progress $state $count $row"
    .t configure -state $state
    incr count -1
    if {$count < 0} {
    set count 10
    incr row
    }
    if {$row < [.t rowcount]} {
    .t cellconfigure $row,1 -background [expr {$count % 2 ? "green1" : "white"}]
    after 500 [list progress $state $count $row]
    } else {
    puts "done"
    }
    }
    progress normal 10 0

    This changes the background of the second cell in each row while
    processing.

    However, with state 'disabled'

    progress disabled 10 0

    the color change does not happen.

    While this is documented behaviour for tablelist, I would still like to
    have some means to indicate the row being currently processed.

    Apart from embedding some labels or other widgets, any other ideas?
    Would a state 'readonly' (like in comboboxes) be feasible?

    TNX
    R'

    Although not mentioned in the manual :-( , you can change the font of a tablelist cell in the disabled state, too. This leads to the following solution proposal:

    Insert the following lines before the progress procedure

    set tblFont [.t cget -font]
    font create UlFont {*}[font actual $tblFont] -underline 1

    and change the procedure's line starting with ".t cellconfigure" to become

    .t cellconfigure $row,1 -font [expr {$count % 2 ? "UlFont"
    : $::tblFont}]

    Here we are using the font option -underline, which, unlike -weight,
    doesn't change the cell text's width in pixels.
    --
    Csaba Nemethi https://www.nemethi.de mailto:csaba.nemethi@t-online.de
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ralf Fassel@ralfixx@gmx.de to comp.lang.tcl on Mon Sep 28 11:13:37 2026
    From Newsgroup: comp.lang.tcl

    * nemethi <csaba.nemethi@t-online.de>
    | Am 25.09.26 um 12:38 schrieb Ralf Fassel:
    | > However, with state 'disabled'
    | > progress disabled 10 0
    | > the color change does not happen.
    | > While this is documented behaviour for tablelist, I would still like
    | > to have some means to indicate the row being currently processed.
    | > Apart from embedding some labels or other widgets, any other ideas?
    | > Would a state 'readonly' (like in comboboxes) be feasible?
    --<snip-snip>--

    | Although not mentioned in the manual :-( , you can change the font of
    | a tablelist cell in the disabled state, too. This leads to the
    | following solution proposal:

    | Insert the following lines before the progress procedure

    | set tblFont [.t cget -font]
    | font create UlFont {*}[font actual $tblFont] -underline 1

    | and change the procedure's line starting with ".t cellconfigure" to become

    | .t cellconfigure $row,1 -font [expr {$count % 2 ? "UlFont"
    | : $::tblFont}]

    | Here we are using the font option -underline, which, unlike -weight,
    | doesn't change the cell text's width in pixels.

    Thanks, Csaba, that looks promising, plus I think I would use
    rowconfigure to have the whole row underlined (better visual clue).
    I will experiment with it!

    R'
    --- Synchronet 3.22a-Linux NewsLink 1.2