TIP 541: Add support for 'end' index in ttk::combobox current

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.
Author:         Fran├žois Vogel <[email protected]>
State:          Draft
Type:           Project
Vote:           In progress
Created:        8-May-2019
Post-History:   
Keywords:       Tcl
Tcl-Version:    8.6
Tcl-Branch:     bug-2858503fff

Abstract

This TIP proposes to add support for the end logical index in the current command of ttk::combobox.

Rationale

ttk::combobox current newIndex sets the combobox value to the element at position newIndex in the list of the combobox -values. So far only integers were supported as newIndex.

It would be consistent with other uses of indices, and certainly useful, to be able to specify newIndex as the end index, that is the last element in the list of the combobox -values.

This was originally requested in a RFE.

Specification

ttk::combobox current newIndex

If newIndex is supplied, sets the combobox value to the element at position newIndex in the list of -values (in addition to integers, the end index is supported and indicates the last element of the list). Otherwise, returns the index of the current value in the list of -values or -1 if the current value does not appear in the list.

Implementation

See the bug-2858503fff branch, aka tip-541. This branch includes implementation, updated documentation and new tests.

The branch targets 8.6 since there is no danger of incompatibility: the new feature was an error case so far.

Copyright

This document has been placed in the public domain.