# TIP 541: Add support for 'end' index in ttk::combobox current
Author: Francois Vogel <[email protected]>
State: Final
Type: Project
Vote: Done
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 <b>end</b> logical index in the <b>current</b> command of <b>ttk::combobox</b>.
# Rationale
<b>ttk::combobox current</b> <i>newIndex</i> sets the combobox value to the element at position <i>newIndex</i> in the list of the combobox <b>-values</b>. So far only integers were supported as <i>newIndex</i>.
It would be consistent with other uses of indices, and certainly useful, to be able to specify <i>newIndex</i> as the <b>end</b> index, that is the last element in the list of the combobox <b>-values</b>.
This was originally requested in a [RFE](https://core.tcl-lang.org/tk/tktview/2858503fffffffffffffffffffffffffffffffff).
# Specification
<b>ttk::combobox current <i>newIndex</i></b>
If <i>newIndex</i> is supplied, sets the combobox value to the element at position <i>newIndex</i> in the list of <b>-values</b> (in addition to integers, the <b>end</b> index is supported and indicates the last element of the list). Otherwise, returns the index of the current value in the list of <b>-values</b> or -1 if the current value does not appear in the list.
# Implementation
See the [`bug-2858503fff`](https://core.tcl-lang.org/tk/timeline?r=bug-2858503fff&unhide) branch, aka [`tip-541`](https://core.tcl-lang.org/tk/timeline?r=tip-541&unhide). 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.