f



Tk::Text, is there a selection?

Hi,

from the documentation to Tk::Text i concluded that i can get
the selection by:

$txt->get('sel.first', 'sel.last');

But i need to test if there IS a selection.  To do this i
should test if the option "exportSelection" is true.

How do i do that?  I tried:

$t->cget('exportSelection')

But that was always true.  How do i test for the selection?


Best regards,
Torsten.

0
Torsten
9/6/2004 9:32:20 PM
comp.lang.perl.tk 4721 articles. 0 followers. pharrendorf (19) is leader. Post Follow

4 Replies
482 Views

Similar Articles

[PageSpeed] 57

In article <chil14$bpn$1@schleim.qwe.de>, tmohr@s.netic.de says...
> Hi,
> 
> from the documentation to Tk::Text i concluded that i can get
> the selection by:
> 
> $txt->get('sel.first', 'sel.last');

Or via $txt->getSelected;

> But i need to test if there IS a selection.  To do this i
> should test if the option "exportSelection" is true.
> 
> How do i do that?

What's wrong with:

	print "Nothing selected\n" unless $t->getSelected;

-- 
  Go to http://MarcDashevsky.com to send me e-mail.
0
Marc
9/6/2004 10:11:28 PM
Hi,

> Or via $txt->getSelected;

that works, thanks!

> What's wrong with:
> 
> print "Nothing selected\n" unless $t->getSelected;

I do not find any reference to "getSelected" in Tk::Text,
even now that i know it exists.  Else i think i would have
used it.


Thanks,
Torsten.

0
Torsten
9/8/2004 6:26:53 PM
In article <chnitd$a5l$1@schleim.qwe.de>, tmohr@s.netic.de says...
> Hi,
> 
> > Or via $txt->getSelected;
> 
> that works, thanks!
> 
> > What's wrong with:
> > 
> > print "Nothing selected\n" unless $t->getSelected;
> 
> I do not find any reference to "getSelected" in Tk::Text,
> even now that i know it exists.  Else i think i would have
> used it.

I'm running perl/Tk 804.027 and the getSelected method is documented,
so perhaps the pod has been improved.

-- 
  Go to http://MarcDashevsky.com to send me e-mail.
0
Marc
9/8/2004 8:07:59 PM
"Marc Dashevsky" <usenet@MarcDashevsky.com> wrote in message
news:MPG.1ba930a77a3566c0989a45@netnews.comcast.net...
> In article <chnitd$a5l$1@schleim.qwe.de>, tmohr@s.netic.de says...
> > I do not find any reference to "getSelected" in Tk::Text,
> > even now that i know it exists.  Else i think i would have
> > used it.
>
> I'm running perl/Tk 804.027 and the getSelected method is documented,
> so perhaps the pod has been improved.

Yes. I did that for 804; with the permission of O'Reilly publishing and
Steve of course ;)

As wonderful as Mastering Perl/Tk is - I got tired of having to always look
them up. Surprisingly, the book binding has held up rather well around p.189

Jack


0
Jack
9/9/2004 12:24:39 AM
Reply: