Tk Source Code

Artifact [fdabc395]
Login

Artifact fdabc3952307cb99101c6ee3a40d5f489e1a0d273dfe026a108983b7929e1f86:

Attachment "Looking for actual changes is futile.tcl" to ticket [2a6c62af] added by fvogel 2022-03-07 22:07:36.
package require Tk

ttk::treeview .t
pack .t -fill both -expand 1

for {set i 1} {$i < 6} {incr i} {
    .t insert {} end -text "Item # $i"
}

bind .t <<TreeviewSelect>> show

proc show {} {
    puts "TreeviewSelect fired"
    puts "Current selection is '[ .t selection ]'"
}
proc haha {} {
    set old [.t selection]
    .t selection set ""
    .t selection set $old
}

button .b1 -text "Clear Selection" -command {.t selection set ""}
button .b2 -text "Delete Selected" -command {.t delete [.t selection]}
button .b3 -text "No change" -command {haha}

pack .b1 .b2 .b3 -side top -fill x