Checking for marked or selected text in a Text widget 
Author Message
 Checking for marked or selected text in a Text widget

Newbie question:

How can you tell or check to see if any text in a Text widget has been selected?

Thanks,
Cristov



Mon, 18 Jul 2005 11:13:07 GMT  
 Checking for marked or selected text in a Text widget
Hi Chris,

The answer is trivial - see perldoc Tk::Text;

My example:

use Tk;
$mw=MainWindow->new;
$t = $mw->Text()->pack;
$t->bind('<3>',\&right_click);
MainLoop;
sub right_click
{

  if($t->tagRanges('sel'))
  {
    # selection exist!

  }

Quote:
}

Regards,
    Felix.da.ru
Quote:

> Newbie question:

> How can you tell or check to see if any text in a Text widget has been selected?

> Thanks,
> Cristov



Mon, 18 Jul 2005 17:35:41 GMT  
 Checking for marked or selected text in a Text widget

Quote:

> Hi Chris,

> The answer is trivial - see perldoc Tk::Text;

> My example:

> use Tk;
> $mw=MainWindow->new;
> $t = $mw->Text()->pack;
> $t->bind('<3>',\&right_click);
> MainLoop;
> sub right_click
> {

>   if($t->tagRanges('sel'))
>   {
>     # selection exist!

>   }

> }

> Regards,
>     Felix.da.ru


> > Newbie question:

> > How can you tell or check to see if any text in a Text widget has been selected?

> > Thanks,
> > Cristov

Thanks, works great.

Cristov



Tue, 19 Jul 2005 01:19:27 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Converting plain text to marked-up text.

2. Checking for selected text

3. Colors in Text widget and select colors

4. How to select in a Text widget?

5. select & copy on a text widget

6. Q: Changing Text-Color in Text-Widget?

7. text formatting in a Text widget

8. How update text in text widget when executing some other callback

9. Color Coding Text in a Tk::Text Widget

10. Grabbing Text from Text widget

11. Retrieving a line of text from a Text Widget when clicking on it

12. Making text appear in a text widget...

 

 
Powered by phpBB® Forum Software