summaryrefslogtreecommitdiffstats
path: root/library/ttk
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2019-11-01 20:54:55 (GMT)
committerfvogel <fvogelnew1@free.fr>2019-11-01 20:54:55 (GMT)
commitaa42e365e10d36a627c74dd41c016fa92a1e36b6 (patch)
tree7e20cd0bf1fa11eebed87be9f774663051bc23dd /library/ttk
parente9a1e3c613316cca80d5f527791041e62f53a9ca (diff)
downloadtk-aa42e365e10d36a627c74dd41c016fa92a1e36b6.zip
tk-aa42e365e10d36a627c74dd41c016fa92a1e36b6.tar.gz
tk-aa42e365e10d36a627c74dd41c016fa92a1e36b6.tar.bz2
The previous commit [65bb96b4] was wrong: it did not take into account the specifics of -displaycolumns or the fact column #0 (the tree) is special. This introduced a regression in the headings activation: they did not de-activate properly when the mouse left the headings. Fix this and document in the code why catching is (much) easier than writing an explicit proc.
Diffstat (limited to 'library/ttk')
-rw-r--r--library/ttk/treeview.tcl15
1 files changed, 12 insertions, 3 deletions
diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl
index 4158739..df188b7 100644
--- a/library/ttk/treeview.tcl
+++ b/library/ttk/treeview.tcl
@@ -120,9 +120,18 @@ proc ttk::treeview::ActivateHeading {w heading} {
variable State
if {$w != $State(activeWidget) || $heading != $State(activeHeading)} {
- if {[winfo exists $State(activeWidget)] && $State(activeHeading) != {}
- && $State(activeHeading) in [$State(activeWidget) cget -displaycolumns]} {
- $State(activeWidget) heading $State(activeHeading) state !active
+ if {[winfo exists $State(activeWidget)] && $State(activeHeading) != {}} {
+ # It may happen that $State(activeHeading) no longer corresponds
+ # to an existing display column. This happens for instance when
+ # changing -displaycolumns in a bound script when this change
+ # triggers a <Leave> event. A proc checking if the display column
+ # $State(activeHeading) is really still present or not could be
+ # written but it would need to check several special cases:
+ # a. -displaycolumns "#all" or being an explicit columns list
+ # b. column #0 display is not governed by the -displaycolumn
+ # list but by the value of the -show option
+ # --> Let's rather catch the following line.
+ catch {$State(activeWidget) heading $State(activeHeading) state !active}
}
if {$heading != {}} {
$w heading $heading state active