Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.
|Comment:||New TIP: ellipses for Tk|
|Downloads:||Tarball | ZIP archive | SQL archive|
|Timelines:||family | ancestors | descendants | both | trunk|
|Files:||files | file ages | folders|
|User & Date:||Donal 2019-11-07 23:17:44|
|23:20||Update index check-in: 16b6b2cd8a user: Donal tags: trunk|
|23:17||New TIP: ellipses for Tk check-in: c368e0d5ea user: Donal tags: trunk|
|22:00||Updated 552 check-in: 2a5c9376de user: pspjuth tags: trunk|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
# TIP 553: Ellipses: the Alternative to Scrolling and Wrapping Author: Donal K. Fellows <[email protected]> State: Draft Type: Project Vote: Pending Created: 07-Nov-2019 Post-History: Tcl-Version: 8.7 Keywords: Tk, label, listbox, entry ----- # Abstract This TIP proposes a mechanism for getting Tk widgets to insert an ellipsis instead of wrapping or scrolling (in widgets where this makes sense) a line of text. # Rationale Adding an ellipsis when a piece of text is too wide to be shown in its entirety is a common modern GUI idiom, and one that is relatively easily implemented in Tcl/Tk as is. However, we do this in general by measuring the text (with `font measure`) by hand and determining where the ellipsis should be inserted, and then modifying the text itself to insert the ellipsis. This makes it difficult to make the position of the ellipsis change as the width of the widget changes, as we have to add code that observes the change to the View (via a `<Configure>` event on the widget) and update the Model in response, despite the _true underlying_ Model not changing at all. Instead, we should have the widgets do the work for us, so that we can just indicate what the true text is and tell Tk that it should insert ellipses as and where required without further user intervention. # Specification When a widget supports applying an ellipsis, it will take a new option, `-ellipsis`, that will allow the specification of an ellipsis (as a string; there are multiple ways of expressing an ellipsis, and the right choice depends on other features of the interface) that gives a symbol to use after trimming off the text _at a character boundary_ in order for the text including the ellipsis to fit inside the widget's width. For label-based widgets (i.e., labels, buttons, checkbuttons, radiobuttons) the existing `-wraplength` will be used as the limit width for ellipsis insertion, where defined. Otherwise the width of the text part of the widget (based on the widget width and the impact of any compound images) will be used. For the entry-based and listbox-based widgets (including spinboxes and comboboxes) the widget width will be used. Note that the ellipsis insertion code will always use the font set in the widget, and widgets that are so narrow that they cannot display the ellipsis itself may look strange. # Implementation To be done. # Copyright This document is placed in public domain.