I can load it with text, search it, add tags for colors, etc, all sorts
of goodies but I just can't seem to find the magic cookies for:
1. moving the cursor to a index - i.e. making that index the current
(seems like I should say something like .textarea index set current 1.0)
2. I can find my current cursor, but how do I get the selection? I.E. a
start and end index from a dragged selection..
Also, I've found documentation on the web, and a few small tutorials.
But does any have anything they recommend (web page, book, etc)...
Many thanks....
Steve
.txtarea mark set insert 1.0
> 2. I can find my current cursor, but how do I get the selection? I.E. a
> start and end index from a dragged selection..
>
there is a special tag called sel that is the current selection
.textarea tag ranges sel
> Also, I've found documentation on the web, and a few small tutorials.
> But does any have anything they recommend (web page, book, etc)...
>
Check out
http://wiki.tcl.tk
it has many good examples/discussions/links/etc on tcl
For hard copy books I would recommend http://wiki.tcl.tk/8449
but there are others - see http://wiki.tcl.tk/57
or http://wiki.tcl.tk/references/3334
Bruce
.textarea mark set insert 1.0
>
> 2. I can find my current cursor, but how do I get the selection? I.E. a
> start and end index from a dragged selection..
>
set start [.textarea index sel.first]
set end [.textarea index sel.last]
# or...
set range [.textarea tag ranges sel]
Look again at the text widget man page and you'll see mention of the
special marks "insert" and "sel".
You may have a look at my article from the EuroTcl conference 2003.
It describes a number of uses of the text widget and the code fragments
should give you an idea about how things are done.
Follow the links at: <http://wiki.tcl.tk/6273>
Regards,
Arjen