Artifact
68776d60c5da2b85fd2a4ad39a1efd1b8a7bb972:
Attachment "tts.tcl" to
ticket [2677890f]
added by
nobody
2009-03-10 15:27:34.
package require Tk
proc create { } {
destroy .t1 .t2 .sy
pack [text .t1 -width 10] [text .t2 -width 10] [scrollbar .sy -orient vertical] -side left -fill both
.t1 configure -yscrollcommand [list my_yset .t1 .t2 .sy]
.t2 configure -yscrollcommand [list my_yset .t1 .t2 .sy]
.sy configure -command [list my_yview .t1 .t2 .sy]
set txt ""
for { set i 0 } { $i < 1000 } { incr i } {
lappend txt "$i" [list pc $i] "\n" ""
}
eval .t1 insert end $txt
eval .t2 insert end $txt
}
proc my_yset {t1 t2 sy args} {
eval $sy set $args
my_yview $t1 $t2 $sy moveto [lindex [$sy get] 0]
}
proc my_yview {t1 t2 sy args} {
eval $t1 yview $args
eval $t2 yview $args
}
proc mod { {idx 6.0} } {
.t1 delete $idx
.t1 insert $idx "*"
}
proc test { } {
for { set i 0 } { $i < 100 } { incr i } {
create
update
mod
update
}
}
pack [button .c -text "Test" -command test]
create