Posted to tcl by jenglish at Tue Nov 17 19:23:28 GMT 2009view raw
- ## tvSortBy $tv $column ?parent? --
- # Sort treeview values by column
- #
- proc tvSortBy {tv column {parent {}}} {
- set l [list]
- foreach item [$tv children $parent] {
- lappend l [list $item [$tv set $item $column]]
- }
- set o [list]
- foreach pair [lsort -dictionary -index 1 $l] {
- lappend o [lindex $pair 0]
- }
- $tv children $parent $o
- }