Selection

Selection support is implemented via tags. If the exportSelection option for the text widget is true then the sel tag will be associated with the selection:

  1. Whenever characters are tagged with sel the text widget will claim ownership of the selection.
  2. Attempts to retrieve the selection will be serviced by the text widget, returning all the characters with the sel tag.
  3. If the selection is claimed away by another application or by another window within this application, then the sel tag will be removed from all characters in the text.
  4. Whenever the sel tag range changes a virtual event <<Selection>> is generated.

The sel tag is automatically defined when a text widget is created, and it may not be deleted with the (#<widget> 'tag 'delete ...) widget command. Furthermore, the selectbackground, selectborderwidth, and selectforeground options for the text widget are tied to the -background, -borderwidth, and -foreground options for the sel tag: changes in either will automatically be reflected in the other.


© Author | Home | Sitemap