| Store | Cart

Re: [TCLCORE] [Pre-CFV] - RFQ - TIP 541: ttk::combobox current

From: François Vogel <fvog...@free.fr>
Tue, 14 May 2019 14:29:18 +0200 (CEST)
----- Mail original -----
De: "Donald Arseneau" <a...@triumf.ca>
À: tcl-...@lists.sourceforge.net
Envoyé: Mardi 14 Mai 2019 07:52:00
Objet: [TCLCORE] [Pre-CFV] - RFQ - TIP 541: ttk::combobox current

> Was there thought put to making this ("end" index for ttk::combobox) truly > symmetric with list indices, where "end-1" etc are also supported? It would > be great if the internals were shared, to reduce future divergence. 
This is actually a good question. Short answer is no, I didn't think about this so far. But now I just did and here is what I can say about this idea.

In Tcl, support for indices of the type "M+N", "M-N", "end-N", "end+N" was added by TIP #176. TclGetIntForIndex was enhanced to support this syntax, and the lists operations took advantage of it.

In Tk, unless I missed something, no widget supports this syntax. At least entry, spinbox, listbox, ttk:entry, ttk::spinbox, ttk::combobox do not. The text widget neither supports this, however there are indices modifiers that provide this feature but the programmer needs to specify the "unit" (chars, lines, display lines...) of the offset. It's not just "end-3" for instance. Moreover, spaces before or after the +/- sign are supported by the text widget, which is not the case for list index arithmetic.

Now taking advantage of TclGetIntForIndex() in Tk could be done, and then we would propagate this to all Tk areas where it's useful (that is entry, spinbox, listbox, ttk:entry, ttk::spinbox, ttk::combobox). Given that a. no existing Tk widget already has this, b. we can do it later without breaking compatibility and c. it's a quite larger project than what TIP #541 is targeting, I suggest this to be the subject of another TIP. Also I believe this would mean promoting TclGetIntForIndex() to the public interface as Tcl_GetIntForIndex(), and then document it.


Tcl-Core mailing list
Recent Messages in this Thread
Donald Arseneau May 14, 2019 05:52 am
François Vogel May 14, 2019 12:29 pm
Zaumseil René May 14, 2019 02:45 pm
Jan Nijtmans May 15, 2019 03:03 pm
Donald G Porter via Tcl-Core May 15, 2019 03:10 pm
Donald Arseneau May 18, 2019 12:06 am
Messages in this thread