| Ticket UUID: | 7aae3d0fe508fb7c6d88553318fbd84111f39d47 | |||
| Title: | ttk::treeview's move command does nothing when moving down in Tk 9.1 | |||
| Type: | Bug | Version: | 9.1 | |
| Submitter: | m.n.summerfield | Created on: | 2026-10-05 12:30:43 | |
| Subsystem: | 88. Themed Tk | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Important | |
| Status: | Closed | Last Modified: | 2026-10-10 20:01:42 | |
| Resolution: | Fixed | Closed By: | bohagan | |
| Closed on: | 2026-10-10 20:01:42 | |||
| Description: |
If you run the following program in 9.0.3 it works fine. You can press the Up and Down buttons and the selected item will move up and down as expected. But in 9.1.0 pressing Down doesn't work; also the focus looks odd in 9.1.0 compared with 9.0.3.
| |||
| User Comments: |
bohagan added on 2026-10-10 20:01:42:
No response from initiator. Closing as fixed. bohagan added on 2026-10-06 03:35:33: I found the issue. The logic did not account for the need to go to the next item when the move to index is after the item's current index. See branch treeview_move_bug_7aae3d0fe5 and commit [ed9a60d0]. I tested it on 8.6, 9.0, and 9.1. Let me know if you see any further issues.
If you want something that will work now and after the fix use the following:
Add this before you set the selection...
".tree focus moveme"
... and replace on_up and on_down with:
if {$::tk_version < 9.1} {
proc on_up {} {
if {[set id [.tree focus]] eq ""} {
set id [lindex [.tree children {}] 0]
}
if {$id ne ""} {
if {[set prev [.tree prev $id]] ne ""} {
.tree move $id {} [.tree index $prev]
puts "move $id up"
}
}
}
proc on_down {} {
if {[set id [.tree focus]] eq ""} {
set id [lindex [.tree children {}] 0]
}
if {$id ne ""} {
if {[set next [.tree next $id]] ne ""} {
.tree move $id {} [.tree index $next]
puts "move $id down"
}
}
}
} else {
proc on_up {} {
if {[set id [.tree focus]] eq ""} {
set id [.tree id {} 0]
}
if {$id ne ""} {
if {[set prev [.tree before $id]] ne ""} {
.tree move $id before $prev
puts "move $id up"
}
}
}
proc on_down {} {
if {[set id [.tree focus]] eq ""} {
set id [.tree id {} 0]
}
if {$id ne ""} {
if {[set next [.tree after $id]] ne ""} {
.tree move $id after $next
puts "move $id down"
}
}
}
}
| |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki