Tk Source Code

Ticket Change Details
Login
Overview

Artifact ID: 5245e5ba6f892e2cb659d73f83e352facfb6980a
Ticket: 2a6c62afd9c0d1d84ec0ef8407eb5613686a8b52
ttk::treeview <<TreeviewSelect>> event bug
User & Date: anonymous 2014-01-19 23:52:17
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    Tcl/Tk version 8.6.1
    
    I just noticed while experimenting with the ttk::treeview that the treeview widget does not fire a <<TreeviewSelect>> event when an item that is presently selected is deleted.
    
    Is this an intended outcome?  The manpage says:
    
           <<TreeviewSelect>>
               Generated whenever the selection changes.
    
    It would seem that deleting an item that is selected is also a change to the selection, which should have fired a TreeviewSelect event.
    
    Demo code:
    
      #!/usr/bin/wish
    
      ttk::treeview .t
    
      pack .t
    
      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 ]'"
      }
    
      button .b1 -text "Clear Selection" -command {.t selection set ""}
      button .b2 -text "Delete Selected" -command {.t delete [.t selection]}
    
      pack .b1 .b2 -side top
    
    Run the demo from a terminal so you can see the output of the puts.  Select one or more items with the mouse, notice the event fires.  While one or more items are selected, clear the selection using the "Clear Selection" button.  Notice that the event fires.
    
    Now select one or more items and push the "delete selected" button.  Notice the items are deleted (and the selection disappears, because the selected items no longer exist) but no event fires.
    
  5. foundin changed to: "8.6.1"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "4fc15a9fd36528d4bf38dcb7fcef28bbd405fde3"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "88. Themed Tk (Ttk)"
  15. title changed to: "ttk::treeview <<TreeviewSelect>> event bug"
  16. type changed to: "Bug"