Author: Harald Oehlmann <[email protected]>
State: Final
Type: Project
Vote: Done
Created: 03-May-2025
Tcl-Version: 9.1
Tk-Branch: rfe-d632d28ba4
Vote-Summary: Accepted 9/0/0
Votes-For: AK, AN, FV, JN, HO, KW, MC, RA, SL
Votes-Against: none
Votes-Present: none
Keywords: ttk::treeview
Abstract
This TIP proposes to add new states to allow to change images of the ttk::treeview and ttk::notebook widgets in dependency of widget item states.
Background
The original request is this Tk ticket d632d28ba4.
Starting with Tk 9.0, the assignment state dependent images for the tree indicators of a ttk::treeview widget is not possible any more, as the so far used states "user1" and "user2" are not assigned any more by the treeview code.
The proposal is to assign new state codes which are dedicated to the usage. In addition, the notebook widget has the same issue, that first or last tab image may vary in the form.
Rationale
Make it possible to assign state dependent ttk::treeview indicator images.
The following code worked in Tk 8.6:
ttk::style element create Treeitem.indicator \
image [list $image_for_closed \
user1 $image_for_open \
user2 $image_for_no_children \
]
It does not work in Tk 9.0.
In Tk 9.1, this may be replaced by:
ttk::style element create Treeitem.indicator \
image [list $image_for_closed \
open $image_for_open \
leaf $image_for_no_children \
]
The same is for ttk::notebook, where the tab images may require to know, if there are any neighbours.
Specification
Add the following new states and addign them to the ttk::treeview widget:
* leaf: leaf with no children indicator
* open: open leaf indicator
In addition, add the following states for the notebook widget:
* first: first tab
* last: last tab
Compatibility
Fully backward compatible to Tk 9.0. Incompatible to 8.6 by design and purpose, as the usage of user1 and user2 was seen as an abuse.
Discussion
Reference Implementation
A reference impementation can be found in Tk branch rfe-d632d28ba4.
Copyright
This document has been placed in the public domain.