Tk Source Code

View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
Ticket UUID: 2858503
Title: "end" flag for ttk::combobox current
Type: RFE Version: None
Submitter: luckyluke67 Created on: 2009-09-14 10:45:42
Subsystem: 88. Themed Tk Assigned To: fvogel
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2019-05-26 18:43:22
Resolution: Fixed Closed By: fvogel
    Closed on: 2019-05-26 18:43:22
the ttk::combobox widget has a "current" method which allow to choose which item of the list given to the combobox to be displayed. Unfortunatly, this method doesn't accept the "end" mark, specifying the end of the list.
It would be great to have to "end" indice available in order to avoid computation of the length of the list before invoking <pathname> current method.
User Comments: fvogel added on 2019-05-26 18:43:22:
Merged to core-8-6-branch and trunk following acceptance of TIP #541 through TCT vote.

fvogel added on 2019-05-08 20:47:26: (text/x-fossil-wiki)
After discussing the matter with myself I decided that merging this would need a TIP.

[|TIP #541] is now created and sits in draft state. RFQ sent to the tcl-core list.

fvogel added on 2019-05-03 20:50:22: (text/x-fossil-wiki)
Implemented, with new tests and updated documentation, in branch [|bug-2858503fff].

mickey_knox added on 2009-09-20 03:42:48:
DIFF-ed against version 1.17

diff -ru ..\tksrc_orig/generic/ttk/ttkEntry.c ./generic/ttk/ttkEntry.c
--- ..\tksrc_orig/generic/ttk/ttkEntry.c2009-09-19 22:35:23.828125000 +0200
+++ ./generic/ttk/ttkEntry.c2009-09-19 22:40:44.046875000 +0200
@@ -1760,7 +1760,10 @@
 Tcl_SetObjResult(interp, Tcl_NewIntObj(currentIndex));
 return TCL_OK;
     } else if (objc == 3) {
-if (Tcl_GetIntFromObj(interp, objv[2], &currentIndex) != TCL_OK) {
+if(!strcmp(Tcl_GetString(objv[2]), "end")) {
+currentIndex = nValues - 1;
+else if (Tcl_GetIntFromObj(interp, objv[2], &currentIndex) != TCL_OK) {
     return TCL_ERROR;
 if (currentIndex < 0 || currentIndex >= nValues) {