Posted to tcl by Stu at Sun Oct 02 13:30:53 GMT 2022view raw
- # May need high keyboard repeat rate to be observable.
- # xset r rate 100 100; wish tvjitter.tcl; xset r rate
- bind . <Control-q> exit
- proc randstr {{length {6}}} {
- set str ""
- for {set i 0} {$i < $length} {incr i} {
- append str [format %c [expr {97 + int(rand() * 26)}]]
- }
- return $str
- }
- set extra [list]
- #lappend extra -show headings
- grid [ttk::treeview .t -columns {a b c} -height 30 {*}$extra]
- bind .t <Key-Down> [list down]
- proc down {} {
- set item [.t next [.t focus]]
- if {$item eq ""} { return -code break }
- set index [.t index $item]
- .t focus $item
- # Try with one of these. Is there noticeable jitter?
- .t see $item
- #if {$index > 29} {.t yview scroll 1 units}
- #.t yview moveto [expr {double($index - 29) / 500.0}]
- .t selection set [list $item]
- return -code break
- }
- for {set i 0} {$i < 500} {incr i} {
- .t insert {} end -values [list $i [randstr] [randstr]]
- }
- focus .t
- .t focus I001
- .t selection set I001