Home > Archive > Tcl > July 2004 > Selecting text
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Phil Biehl 2004-06-30, 9:00 pm |
| I have a text widget setup with some inital text that I would like to have
preselected so the user can overstrike the text by typing in any character.
I've been looking at the text tags and see there is a "sel" tag. Will this
tag do this for me? Also, I'm having a heck of a time trying to figure out
how to format the text widget to use this tag.
Any help much appreciated!
| |
| SM Ryan 2004-06-30, 9:00 pm |
| "Phil Biehl" <fylbeall@yahoo.com> wrote:
# I have a text widget setup with some inital text that I would like to have
# preselected so the user can overstrike the text by typing in any character.
# I've been looking at the text tags and see there is a "sel" tag. Will this
# tag do this for me? Also, I'm having a heck of a time trying to figure out
# how to format the text widget to use this tag.
Yes, the sel tag corresponds to selected text. You can use
exportselection to effect how selections interact with the
clipboard.
There are bindings that if you type anything when there is
text tagged with sel, it will be replace with what is typed.
sel tagged text can be discontiguous, but attempts to exploit
discontiguous selections will mostly fail.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
The whole world's against us.
| |
| Donal K. Fellows 2004-07-01, 8:58 am |
| Phil Biehl wrote:
> Also, I'm having a heck of a time trying to figure out
> how to format the text widget to use this tag.
Simple. Just apply the tag after you've set up the contents of the
widget (in any way you want). For example, here's how to pre-select
everything:
.txt tag add sel 1.0 end
If you want to just select a smaller range of text, choose different
indices. :^)
Donal.
|
|
|
|
|