Tk Source Code

View Ticket
Login
Ticket UUID: a1d25b487ea3c321e90f1a02666c258e6101350a
Title: ttk::frame does not honor -borderwidth
Type: Bug Version: 8.6.8
Submitter: bll Created on: 2019-09-10 23:59:12
Subsystem: (unused) Assigned To: fvogel
Priority: 3 Low Severity: Minor
Status: Closed Last Modified: 2019-09-29 08:26:36
Resolution: Fixed Closed By: fvogel
    Closed on: 2019-09-29 08:26:36
Description:
A ttk::frame's border width is a fixed size and does not change.

package require Tk
frame .a -borderwidth 3p -background darkred -relief raised
ttk::style configure A.TFrame -borderwidth 3p -background darkblue -relief raised
ttk::frame .b -style A.TFrame
.a configure -width 30 -height 30
.b configure -width 30 -height 30
pack .a .b
User Comments: fvogel added on 2019-09-29 08:26:36:
Merged to core-8-6-branch and trunk.

bll added on 2019-09-23 22:40:18:
Yes, the documentation change seems reasonable.
I would not put in -borderwidth for ttk::frame, as it generally does not work,
even though it may be recognized.

fvogel added on 2019-09-23 20:21:11:

Suggested doc improvement: [fe3586cc]. What do you think, is this clear enough?

Question for you: in that commit I have also added -relief as a possible TFrame styling option, since experiment (for instance with your given test script) proves it works. In your example code you're also using -borderwidth as a styling option, should it be added in the documented list in your opinion? Actually incantating the following:

ttk::style configure A.TFrame -whateverWeWantHere anyValue

is also accepted, but this probably does not mean we should document it.


bll added on 2019-09-23 03:15:23:
Yes, it could use a mention in the manual page.

This is an extremely minor issue.

fvogel added on 2019-09-22 19:27:27:

From a quick analysis of the source code I believe the -borderwidth option is correctly taken into account, i.e. it is correctly processed and its value stored in the configspec of the ttk::frame widget.

However, at the (idle) time of rendering, this value may or may not be used, e.g. the vista theme forces the border width to SM_CXEDGE/SM_CYEDGE in its layout code. It does not use the configured -borderwidth. This must be because actually drawing the border element uses the Windows API function DrawEdge(), which does not have any width parameter so it must be drawing edges having SM_CXEDGE/SM_CYEDGE widths/heights.

On Windows at least, I didn't find any theme making use of the configured -borderwidth, but this is not a bug IMO, it's just that the theme must ignore this parameter otherwise the rendering in that theme would no longer be correct.

It's as if following execution of your provided script you added ttk::style theme use clam and complained that the blue background of the ttk::frame disappeared. That background disappeared because the theme (most likely very correctly) forces it.

See also this note in the implementation of the clam theme (you can experiment based on that note: pack a yellow frame inside .b and play with .b configure -borderwidth xx --> the borderwidth remains small, and the extra space is used as padding).

What do you think? Perhaps something should be said in the man pages?


Attachments: