| Ticket UUID: | b094cb4aa98e57fac8d9b6545188ecdb0ce35d8b | |||
| Title: | ttk::treeview steadily enlarges width when repeatedly configuring -show | |||
| Type: | Bug | Version: | core-8-6-branch | |
| Submitter: | fvogel | Created on: | 2019-12-08 09:49:00 | |
| Subsystem: | 88. Themed Tk | Assigned To: | fvogel | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2019-12-14 20:10:22 | |
| Resolution: | Fixed | Closed By: | fvogel | |
| Closed on: | 2019-12-14 20:10:22 | |||
| Description: |
ttk::treeview steadily enlarges width when repeatedly configuring -show This happens on Windows with vista and xpnative themes, but not with winnative, clam, alt, default or classic themes. It does not happen on macOS with any available theme (aqua, clam, alt, default, classic). I didn't try on Linux. A minimal demo script:
package require Tk
pack [ttk::treeview .t]
update; winfo width .t
.t configure -show {tree}
update; winfo width .t
.t configure -show {tree}
update; winfo width .t
The output of this for me on Windows Vista with "vista" theme is: 203 204 205 So each time the widget gets configured to what it already is configured ( A less minimal demo script exercising the available themes:
package require Tk
pack [ttk::treeview .t]
update; winfo width .t
foreach th [ttk::style theme names] {
puts $th
ttk::style theme use $th ; update
set ref [winfo width .t]
for {set i 1} {$i < 200} {incr i} {
.t configure -show {tree}
update
}
if {$ref ne [winfo width .t]} {
puts " Width changed! --> $ref ne [winfo width .t]"
}
after 2000
}
With vista or xpnative themes only, the widget enlarges its width every time it is configured with what it already has. The treeview width grows ~200 pixels when configuring it 200 times with | |||
| User Comments: |
fvogel added on 2019-12-14 20:10:22:
Merged to core-8-6-branch and trunk. fvogel added on 2019-12-08 21:44:40: With the minimal script provided, analysis shows that:
So the treeview width increase can be noticed when the widget is redrawn, at idle time, however this redraw only makes the problem apparent, it does not create it since it was already here, just not visible. This can be confirmed by the following code showing that the default width of column #0, which should be 200 pixels (this is set in InitColumn()) finds itself increased of 1 pixel after the display update has been performed:
package require Tk
pack [ttk::treeview .t -show {tree}]
.t column #0 -width ; # returns the expected 200 pixels
update
.t column #0 -width ; # returns 201 but it should be 200 !!
What is happening is as follows:
So the question is why TreeviewSize() does return a width that is larger than the current width of the treeview. This is not entirely trivial, but here is what I have found:
The fix therefore consists in setting this IGNORE_THEMESIZE flag when defining the Treeview.field element in the ElementInfoTable of ttkWinXPTheme. This is [8ee62608cc]. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki