Artifact
a0ba585d33a73414af676281c6938d0304f81494197fef8ec82312dc59af47a9:
Attachment "treescroll.tcl" to
ticket [14188104]
added by
cjmcdonald
2020-04-16 11:31:30.
proc init {} {
ttk::treeview .tree \
-height 10 -selectmode extended -show {} \
-columns {label} \
-yscrollcommand [list .vs set]
grid .tree -row 0 -column 0 -rowspan 4 -sticky ns
ttk::scrollbar .vs -command {.tree yview}
grid .vs -row 0 -column 1 -rowspan 4 -padx {1m 1c} -sticky ns
ttk::button .b5 -text "5 rows" -command {setrows 5}
grid .b5 -row 0 -column 2 -pady 2m
ttk::button .b10 -text "10 rows" -command {setrows 10}
grid .b10 -row 1 -column 2 -pady 2m
ttk::button .b20 -text "20 rows" -command {setrows 20}
grid .b20 -row 2 -column 2 -pady 2m
ttk::button .b40 -text "40 rows" -command {setrows 40}
grid .b40 -row 3 -column 2 -pady 2m
}
proc setrows { num } {
.tree delete [.tree children {}]
for {set i 1} {$i<=$num} {incr i} {
.tree insert {} end -id row$i \
-values [list [format "Row %2.2d" $i]]
}
.tree see row1
}
init