TIP 552: Extended treeview functionality.

Login
Bounty program for improvements to Tcl and certain Tcl packages.
    Author:        Peter Spjuth <[email protected]>
    State:         Draft
    Type:          Project
    Vote:          Pending
    Created:       19-Sep-2019
    Post-History:
    Tcl-Version:   8.7
    Keywords:      Tk, treeview
    Tk-Branch:     pspjuth-treeview

Abstract

This TIP proposes a set of new features for the Ttk treeview widget.

Rationale

Each time I have tried to use the Treeview widget it fell short of some feature or another and I had to resort to other means.

This aims to fill in the most common missing pieces.

Specification

The following features are added to the treeview widget.

Locked horizontal scrolling

Adds the ability to lock the first display column(s) from horizontal scrolling.

A new option -titlecolumns n is added, requesting columns to be locked. The tree column counts, even if -show tree is not specified. This is to follow the semantics of #N-indexing of columns. Thus for value N of this option, column #N is the first one that is scrollable.

Cell selection

Adds the ability to select individual cells as well as full rows.

Cell selection is independent of item selection.

Cells are identified with a two element list with item id and column id.

A new subcommand cellselection is added, mirroring the present selection. In addition the cellselection set and cellselection add commands get a version for selecting a rectangular range.

A new option -selecttype type is added to direct default bindings to use either item selection or cell selection.

The identify subcommand is updated with the cell option.

Default bindings are updated to use these features.

The <> virtual event triggers on any selection change including cellselection.

Striped rows

A new option -striped bool is added. This makes every other row get marked with the alternate state, and allows the theme to draw them in a different color. Built in themes are updated to put something fitting at that color.

Column separators

The -show option is extended with the value columnseparators to display a separator between columns. Built in themes are updated to define the separators.

Image anchor for tree

A new item option -imageanchor anchor is added. This controls the placement of the image relative to the text in an item's tree column. Default is "w".

Implementation

Started on branch pspjuth-treeview

Copyright

This document has been placed in the public domain.