TIP 620: Treeview cell padding.

Login
    Author:        Peter Spjuth <[email protected]>
    State:         Final
    Type:          Project
    Vote:          Done
    Vote-Summary:  Accepted 8/0/0
    Votes-For:     MC, BG, KBK, AKU, SL, JN, FV, KW
    Votes-Against: none
    Votes-Present: none
    Created:       9-Mar-2022
    Tcl-Version:   8.7
    Keywords:      Tk, treeview
    Tk-Branch:     pspjuth-treeview

Abstract

This TIP adds a -padding flag to treeview tags.

Rationale

Experimenting with image cells, added in [552], it became apparent that there is no way to choose zero padding for a cell. Placing an image in the corner of a cell, like Excel does when a cell has a comment, feels like a reasonable use case to support.

Outside of the very flexible and configurable TTK_LAYOUT machinery, a fixed 4-pixel horizontal padding is added to every cell which neither themes, styles nor users can affect.

Specification

Tags are extended with the -padding flag. With item tags, it affects all cells in the item, including the tree column. With cell tags, it affect that cell.

The extra padding {4 0} will only be added if no style or tag setting is done. Thus acting as a default value for the "-padding" Cell styling option.

Incompatibilities

If the Cell styling option "-padding" is used in any theme or application, the lost padding will give a visual change. They would need to adjust their padding to include those 4 pixels if they want them. They are now in full control of the padding.

Note that the cell in the tree column has the class "Item". Value cells have the class "Cell", and are the ones affected here.

Implementation

Started on branch pspjuth-treeview

Copyright

This document has been placed in the public domain.