For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > September 2004 > Tk::Text, is there a selection?









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]

 

Author Tk::Text, is there a selection?
Torsten Mohr

2004-09-06, 9:00 pm

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.

Marc Dashevsky

2004-09-06, 9:00 pm

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.
Torsten Mohr

2004-09-08, 4:00 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.

Marc Dashevsky

2004-09-08, 8:56 pm

In article <chnitd$a5l$1@schleim.qwe.de>, tmohr@s.netic.de says...
> Hi,
>
>
> that works, thanks!
>
>
> 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.
Jack D

2004-09-08, 8:56 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'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


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com