# Tk 8.5.8 with Itcl on Linux (does not happen in 8.5.5).
# Error when a *itcl* variable is used as -variable for checkbutton.
# tk::CheckEnter assumes it can access the variable in global scope by prefixing it with "::"
# This is wrong for variables in itcl-namespaces:
wm geometry {.} 100x100
package require Itcl
itcl::class testclass {
private variable foobar 1
constructor {} {
pack [checkbutton .c -indicatoron false -variable [itcl::scope foobar]] -fill x
}
}
testclass #auto
# Move mouse over checkbutton:
# can't read "::@itcl ::testclass0 ::testclass::foobar": no such variable
# can't read "::@itcl ::testclass0 ::testclass::foobar": no such variable
# while executing
# "set ::[$w cget -variable]"
# (procedure "tk::CheckEnter" line 26)
# invoked from within
# "tk::CheckEnter .c"
# (command bound to event)
# proposed patch: use uplevel instead of ::, see attached patch
proposed patch for button.tcl