From: balajee on
Hi,
I created a text window with some text inside it. Now, if highlight
any text with mouse selection, it should automatically be saved into
variable. Can anybody suggest me how to do this?

Thanks,
balajee
From: Jeremy on
On Feb 10, 9:35 am, balajee <balaj...(a)gmail.com> wrote:
> Hi,
>    I created a text window with some text inside it. Now, if highlight
> any text with mouse selection, it should automatically  be saved into
> variable. Can anybody suggest me how to do this?
>

Please see:

http://www.tcl.tk/man/tcl8.6/TkCmd/text.htm#M79

Footnote 4 says that when the selection changes, then the
<<Selection>> event is triggered. Thus, you can bind to that event and
use the "sel" index to get the desired text. You may want to look at
the "get" and "tag" sections of that man page as well.

Jeremy