Menu

#2720 CheckButton Errors

obsolete: 8.5.8
open
5
2009-11-30
2009-11-26
Uwe Traum
No

in library/button.tcl two problems came in with 8.5.8:

both in ::tk::CheckEnter :

1.: according to documentation -selectcolor might be "". This occurs for example in the tablelist-extension.
while computing the color the empty string leads to an runtime error.
we used the background-color if selectcolor is not set - this works for us

2. "set ::[$w cget -variable]" does not work with itcl-vars which were set to -variable using [scope]
we replaced ":set :[$w cget -variable]" with "[namespace inscope :: set [$w cget -variable]]" which works for all cases

the changes in CheckEnter:
-----------------------
# Compute what the "selected and active" color should be.

if {![$w cget -indicatoron]} {
set selcol [$w cget -selectcolor]
if { $selcol eq "" } {
set selcol [$w cget -background]
}

set Priv($w,selectcolor) $selcol
lassign [winfo rgb $w $selcol] r1 g1 b1
lassign [winfo rgb $w [$w cget -activebackground]] r2 g2 b2
set Priv($w,aselectcolor) \
[format "#%04x%04x%04x" [expr {($r1+$r2)/2}] \
[expr {($g1+$g2)/2}] [expr {($b1+$b2)/2}]]

if {[namespace inscope :: set [$w cget -variable]] eq [$w cget -onvalue]} {
$w configure -selectcolor $Priv($w,aselectcolor)
}
}

Discussion

  • Donal K. Fellows

    issue.2904708 is reported related

     
  • Donal K. Fellows

    • labels: 104343 --> 03. [*button] and [label]
    • assigned_to: nobody --> hobbs
     
  • Amit Zaroo

    Amit Zaroo - 2010-01-22

    Faced the same issue. Just removing the preceding "::" from
    set ::[$w cget -variable]

    worked for us. Why was :: put?