| Ticket UUID: | ca403f799b01988bf6c878260eef95777ffaa3a8 | |||
| Title: | ttk::treeview border drawn incorrectly | |||
| Type: | Bug | Version: | ||
| Submitter: | beric | Created on: | 2018-10-08 13:18:46 | |
| Subsystem: | 88. Themed Tk | Assigned To: | fvogel | |
| Priority: | 5 Medium | Severity: | Cosmetic | |
| Status: | Closed | Last Modified: | 2018-10-17 19:58:25 | |
| Resolution: | Fixed | Closed By: | fvogel | |
| Closed on: | 2018-10-17 19:58:25 | |||
| Description: |
It looks like the border is drawn according to the drawing area of the treeview, and not the display area. In fact, the bottom part of the border is visible only when treeview is scrolled at bottom. Platform Windows 10, all themes. | |||
| User Comments: |
fvogel added on 2018-10-17 19:58:25:
Merged to core-8-6-branch and trunk. fvogel added on 2018-10-08 20:10:06: Thanks for having done your homework, it helps :-) ! I see the issue clearly now, and I can reproduce. Analysis is as follows: When drawing the treeview, the call sequence is TreeviewDisplay() --> DrawForest() --> DrawSubtree() Each item is drawn one by one by calling DrawSubtree() which draws a row through DrawItem(). DrawItem() first draws the row background, and then the label. If the drawing of the row background is commented out, the problem disappears. So the problem seems to come from the drawing of one item too much, which draws over the bottom border. This is confirmed by stepping through the code with a debugger: with your example code(*), only items labelled from zero to nine should be displayed when redrawing the treeview. However the current ttk::treeview code attempts to display 11 items instead of 10. I have proposed a fix for this issue, see [810efa5285]. This fixes the problem for me. Note that the issue can also be seen with the standard widget demo "A multi-column list of countries", and that this demo shows the fix in action as well. (*)example code fixed (there was a small mistake in what you provided below):
package require Tk
pack [ttk::treeview .t] -padx 10 -pady 10
for {set i 0} {$i < 15} {incr i} {.t insert {} end -text "Item $i"}
.t yview moveto 0.0 ;#=> No border
.t yview moveto 1.0 ;#=> border OK
beric added on 2018-10-08 14:58:16: Quick script:
package require Tk
pack [ttk::treeview .t] -padx 10 -pady 10
for {set i 0} {$i < 15} {incr i} {.t insert end -text "Item $i"}
.t yview moveto 0.0 ;#=> No border
.t yview moveto 1.0 ;#=> border OK
Probably the same on all Win platform.
beric added on 2018-10-08 14:54:45: Here are some screenshots I took but forgot to add... No time to do the script now... fvogel added on 2018-10-08 14:37:01: Demo script? Snapshot showing the problem? (No Win10 on my desk here to try myself) All this is likely quite obvious for the OP but if I could just paste a snippet to trigger the issue and test potential fixes that would increase the probability of consideration of this bug report. Thanks for your involvement! | |||
Attachments:
- treeview2.png [download] added by beric on 2018-10-08 14:52:32. [details]
- treeview1.png [download] added by beric on 2018-10-08 14:52:08. [details]
