1 # vim: foldmarker=<<<,>>>
3 class tlc
::Textvariable {
7 variable textvariable
""
11 method textvariable_changed
{newvalue
}
12 method set_textvariable
{newvalue
}
16 variable old_textvariable
""
20 method newvalue
{args
}
25 configbody tlc
::Textvariable::textvariable { #<<<1
27 if {$old_textvariable != ""} {
28 trace vdelete
$old_textvariable w
[code
$this newvalue
]
30 if {$textvariable != ""} {
31 trace variable $textvariable wu
[code
$this newvalue
]
32 set old_textvariable
$textvariable
38 body tlc
::Textvariable::newvalue {args
} { #<<<1
39 log debug
"$this lock: ($lock)"
40 if {[lindex $args 2] == "u"} {
45 if {$textvariable == ""} return
46 if {![info exists
$textvariable]} return
48 set newvalue
[set $textvariable]
52 textvariable_changed
$newvalue
54 set oldvalue
$newvalue
57 set $textvariable $oldvalue
61 log
error "\nDerived class textvariable_changed returned error: $errmsg\n$::errorInfo"
68 body tlc
::Textvariable::textvariable_changed {newvalue
} { #<<<1
69 # Override in derived class to be notified of updates to the textvariable
70 log warning
"$this This should be overridden in derived class"
74 body tlc
::Textvariable::set_textvariable {newvalue
} { #<<<1
75 log debug
"$this locked: ($lock)"
80 if {$textvariable != ""} {
81 set $textvariable $newvalue