next up previous contents
Next: Text Tags Up: The Editor Previous: Indices



In an editor (and an entry widget), text can be selected by marking it with the mouse button. Similarly, in list boxes, entries can be selected. Abstractly, these kind of selections are modelled with the selection type classes (module Selection.htmlSelection). There are five classes, of which HasSelection, HasSelectionIndex and HasSelectionIndexRange let you set the selection, and HasSelectionBaseIndex and HasSelectionBaseIndexRange let you query the selection. The selected text, entries etc. are indexed with indices (see Sect. 6.1). The Range classes have a pair of functions, which set or get the start or end of the selection, respectively, whereas the HasSelectionIndex and HasSelectionBaseIndex classes get or set the selection as list of indices.

This selection is Tk-internal (i.e. only works within the same wish), and should not be confused with selection as implemented by X Windows. This selection is handled by the class HasXSelection. Its instances are entries and editors. For those, Tk's selection can also be the X selection. The module XSelection.htmlXSelection allows access to the X selection (get the current selection, selecting wether widgets export their selection etc.)

Christoph Lueth
Wed May 29 13:20:38 MEST 2002