f



RE: text in a widget, text-widget @ 1146167556 #2

Not sure exactly what you are trying to do but it sounds like you want
word that is clicked on.

Quick and dirty way would be:

$scrolled->selectWord();
my $word = $scrolled->getSelected();

The above will only get a single word, so would be a challenge if you
have a link with multiple words.

Lame way:

create a separate tag for each word and bind that to a sub for that
particular word. These seems like
a lot of overhead and I would imagine Text widget would have better
feature you can leverage on.

Efficient way:

? I will leave that up to you ;) or someone else more Text widget savvy
then myself.

Like I mentioned before I had never tried the link thing, just gave it a
quick try yesterday as a
proof that it could be done. Maybe some one else on the list could
provide a better solution. You should
be able figure out where your cursor is and then determine from there. I
don't use Text widgets very often 
in my UI's, only occasionally to display output from child processes
that I am running via some IPC. 
So I have limited knowledge of the feature set of the Text widget. You
may want to check the documentation.

Regards,

Mike

 


-----Original Message-----
From: owner-ptk@lists.stanford.edu [mailto:owner-ptk@lists.stanford.edu]
On Behalf Of Johan Meskens CS3 jmcs3
Sent: Thursday, April 27, 2006 12:59 PM
To: ptk@lists.stanford.edu
Subject: Re: text in a widget, text-widget @ 1146167556



 Intrah onat Diria .. Tue, 25 Apr 2006 13:55:44 -0700
  ,Van Nieuwenhuize, Mike wrote  "Noalim y": 


> 
> Johan,
> 
> Here this will give you an idea how to create a link in a text widget 
> as well as some other tags.
> 
> HTH
> 
> Mike
> 
> use strict;
> use Tk;
> use Tk::Dialog;
> 
> my $mainWindow = MainWindow->new(-title => "Test Tags");
> 
> my $sc_width  = 100;
> my $sc_height = 15;
> 
> my $scrolled =  $mainWindow->Scrolled(
>                                         "Text",
>                                         -scrollbars => 'se',
>                                         -background => 'white',
>                                         -wrap       => 'none',
>                                         -width      => $sc_width,
>                                         -height     => $sc_height,
> 
> 
>                                         )->pack(
>                                                     -fill   => 'both',
>                                                     -expand => '0',
> 
>                                                     );
> 
> #lets set up some color tags for text
> $scrolled->tagConfigure('BLUE',-foreground => 'blue'); 
> $scrolled->tagConfigure('LINK',-underline => 1); 
> $scrolled->tagConfigure('RED',-background => 'red'); 
> $scrolled->tagBind('LINK',"<Button-1>",sub { $scrolled->Dialog(-text 
> => "Hey you pushed the link")->Show()});


i have a textfield where i have multiple pieces of text tagged with
'LINK'



 $scrolled->tagBind('LINK',"<Button-1>",sub { print
$scrolled->GetTextTaggedWith( 'LINK' ) } );

thus the above line prints all LINK-tagged texts how do i get to the
text of the specific link i klik on ?

thanks for your help
kind regards
jmcs3

> 
> my $frame = $mainWindow->Frame( -relief => 'ridge',-borderwidth => 
> 3,);
> 
> my $exitB  = $frame->Button(
>                             -text    => 'EXIT',
>                             -width   => 5,
>                             -command => sub { exit 0},
> 
>                             )->pack(
>                                         -side   => 'left',
>                                         -anchor => 'n',
> 
>                                         );
> 
> $frame->pack(
>                 -expand => 1,
>                 -fill   => 'x',
> 
>                 );
> 
> 
> $scrolled->insert('end',"Here is a green text\n",['GREEN']); 
> $scrolled->insert('end',"Here is a blue link\n",['BLUE','LINK']); 
> $scrolled->insert('end',"Here is a blue text with red 
> background",['BLUE','RED']);
> 
> 
> MainLoop();
> 
> -----Original Message-----
> From: owner-ptk@lists.stanford.edu 
> [mailto:owner-ptk@lists.stanford.edu]
> On Behalf Of Johan Meskens CS3 jmcs3
> Sent: Tuesday, April 25, 2006 11:12 AM
> To: ptk@lists.stanford.edu
> Subject: text in a widget, text-widget
> 
> 
> hello
> 
> 
> i have an application with a couple of text widgets but i would like 
> to add some functionalities that at first and second sight are not 
> directly supported by the plain text widget itself
>  - ?
> 
> for example i would like certain lines of text within the textwidget 
> to take  different background colors according to certain parameters
> 
> also i would like to be able to detect certain sentences or words that

> would become 'links' and by clicking them i would open up different 
> windows
> 
> any suggestions to solutions and widgets for the above problems ?
> 
>  - i probably could use the canvas for the color-thing .. as i write 
> this ..
> 
> kind regards
> jmcs3
> 
> 
> 
> 
> 
> 
> 
> 
> --------the following could be unreadable @ 1145988711   ::: 
> --a-=-t-g-i-
>  , Bottom:
>  , particular
>  , ||
>  , |2
>  , },
>  , oo,loent,uaha
>  , ::::::opthe
>  , lead
>  , |
>  , |---|
>  , _________________
>  ,
> 
> 
> 
> 
> -++**==--++**==--++**==--++**==--++**==--++**==--++**==
> This message was posted through the Stanford campus mailing list
server.
> If you wish to unsubscribe from this mailing list, send the message 
> body of "unsubscribe ptk" to majordomo@lists.stanford.edu
> 
> -++**==--++**==--++**==--++**==--++**==--++**==--++**==
> This message was posted through the Stanford campus mailing list 
> server.  If you wish to unsubscribe from this mailing list, send the 
> message body of "unsubscribe ptk" to majordomo@lists.stanford.edu







--------the following could be unreadable @ 1146167912   ::: 
?
 , >
 , =>
 , paars
 , doubling
 , ,
 ,
670670670670670670670670670670670670e670e670i670iaiiaii670670i2670ei670i
2670670e670fagi670670ga670670ib670PLETATOANITAPLEe
 , |
 , o::m
 , takened
 , t,
 , |
 , 




-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list server.
If you wish to unsubscribe from this mailing list, send the message body
of "unsubscribe ptk" to majordomo@lists.stanford.edu

-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu

0
Van
4/27/2006 10:54:09 PM
comp.lang.perl.tk 4721 articles. 0 followers. pharrendorf (19) is leader. Post Follow

0 Replies
1183 Views

Similar Articles

[PageSpeed] 29

Reply:

Similar Artilces:

Re: text in a widget, text-widget @ 1146167556
Intrah onat Diria .. Tue, 25 Apr 2006 13:55:44 -0700 ,Van Nieuwenhuize, Mike wrote "Noalim y": > > Johan, > > Here this will give you an idea how to create a link in a text widget as > well as some other tags. > > HTH > > Mike > > use strict; > use Tk; > use Tk::Dialog; > > my $mainWindow = MainWindow->new(-title => "Test Tags"); > > my $sc_width = 100; > my $sc_height = 15; > > my $scrolled = $mainWindow->Scrolled( > ...

RE: text in a widget, text-widget #2
Johan, Here this will give you an idea how to create a link in a text widget as well as some other tags. HTH Mike use strict; use Tk; use Tk::Dialog; my $mainWindow = MainWindow->new(-title => "Test Tags"); my $sc_width = 100; my $sc_height = 15; my $scrolled = $mainWindow->Scrolled( "Text", -scrollbars => 'se', -background => 'white', -wrap => &...

RE: text in a widget, text-widget @ 1146167556 #3
Johan, Got to thinking about something that may work for you. Please see my modified code. Basically The only thing that I give it a is a list of words, the tag and tag bind is generated on the fly. Maybe using an approach like this will get you closer to what you wanted. Still kinda lame as you have to create a new tag for each word or in this case url but it at least will allow you to do it on the fly. Mike use strict; use Tk; use Tk::Dialog; my $mainWindow = MainWindow->new(-title => "Test Tags"); my $sc_width = 100; my $sc_height = 15; ...

RE: text in a widget, text-widget
You can use tags with in the text widget. See the documentation in Tk::Text for more explanation on how they work. How to configure: $scrolled->tagConfigure('BLUE',-background => 'blue'); $scrolled->tagConfigure('RED',-foreground => 'red'); $scrolled->tagConfigure('GREEN',-foreground => 'green'); Here is how I use them: $scrolled->insert('end',$job_header,'RED') if ($job_header); $scrolled->insert('end',$running_proc,'BLUE') if ($running_proc); $scro...

Re: text in a widget, text-widget @ 1145998849
Intrah onat Diria .. Tue, 25 Apr 2006 13:55:44 -0700 , ****** wrote "Revera y": > of "unsubscribe ptk" to majordomo@lists.stanford.edu > If you wish to unsubscribe from this mailing list, send the message body > This message was posted through the Stanford campus mailing list server. > ++**=3D=3D > -++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--= > > > > > ,=20 > , _________________ > , |---| > , | > , lead > , ::::::opthe > , oo,loent,uaha > , }, > ,...

text in a widget, text-widget
hello i have an application with a couple of text widgets but i would like to add some functionalities that at first and second sight are not directly supported by the plain text widget itself - ? for example i would like certain lines of text within the textwidget to take different background colors according to certain parameters also i would like to be able to detect certain sentences or words that would become 'links' and by clicking them i would open up different windows any suggestions to solutions and widgets for the above problems ? - i probably could...

Re: Scrolling in a text widget. #2
On Mon, 10 May 2004 slaven@rezic.de wrote: > cj.bj.bj@juno.com wrote: > > > > Is there a way to be able to use a mouse scroller in a text widget? > > > > Upgrade Perl/Tk to 800.025 or 804.027. > or my $t = $top->Scrolled('Text')->pack; $t->bind("<4>", sub{ $t->yview('scroll', $t->cget(-height)*-.5, 'units')}); $t->bind("<5>", sub{ $t->yview('scroll', $t->cget(-height)*.5, 'units')}); -- Ondrej Koala Vacha -++**==--++**==--++**==--++**==--+...

Re: Text over button widget #2
Maybe you could load the image into a canvas and place the text over it in the background of you program.Then you could display it. ----- Original Message ----- From: "Golgi !" <golgi_perl@msn.com> To: <ptk@lists.Stanford.EDU> Sent: Wednesday, June 23, 2004 7:12 PM Subject: Re: Text over button widget > >why not open the gif in photoshop and put text on the image using T tool > >john larson > > Yea, will most likely have to. But I'm trying to use -textvariable because > the name changes to reflect the current julian date. Ki...

Re: Text over button widget #2
--- Golgi ! <golgi_perl@msn.com> wrote: > >why not open the gif in photoshop and put text on > the image using T tool > >john larson > > Yea, will most likely have to. But I'm trying to > use -textvariable because > the name changes to reflect the current julian date. > Kinda rough making 365 > gif's. I'm thinking the next Tk version could > probably include this. Look at Tk::Compound. Tk already supports this, although in a convulted way, IMHO. --Ala __________________________________ Do you Yahoo!? Yah...

re: Confusing behavior regarding selected text in a text widget
This message is directed to whoever replied to my original post. I read it but it was deleted before I could reply. Thank you for your reply and explanation. I knew something was going on but didn't know that the text widget class binding would be triggered. I thought that overriding the widget instance would suffice. Something to learn about. Also, thanks for your observation on my "clipboard append" call- join should be used. By the way, your suggestions did the trick! Thanks again. Mike ...

Re: Getting a pure text widget? #2
Steven, I'm certainly glad I don't have Linux! A friend with Linux couldn't use a style sheet I designed because it used Helvetica font in some of the titles and apparently Linux doesn't handle Helvetica. I finally changed the style sheet to accommodate Linux people. Your problems sound even worse. If the notebook interface works so poorly that you are seriously thinking of writing your own GUI, then I think you have real cause for complaint. Maybe you should think of a Mac, or a Microsoft system, at least for Mathematica. It certainly will be much less expensive than...

Re: Text widget -foreground color #2
Richard, Yes, you have to use text tags. Check the perldoc for Tk::Text or MPTK book for some examples. If I have any examples I will send you a follow up mail with them. Mike At 03:16 PM 3/3/2004 -0500, Markham, Richard wrote: >It appears that when passing $textwidget->configure(-foreground => 'red'); >that it sets the foreground color for all existing and new text. Can I >intermix colors within a text widget? >-++**==--++**==--++**==--++**==--++**==--++**==--++**== >This message was posted through the Stanford campus mailing list >server. I...

highlight text in text widget
Hi, I am trying to make widget that displays text. I also want a search keywords available. The way I have envisioned is something similar to emacs search, i.e. it highlights all the occurrences of the keyword that you are interested in. I am trying to find out if that kind of highlighting be done in widget_text or some other widgets. Can anyone help? Thanks neon writes: > I am trying to make widget that displays text. I also want a search > keywords available. The way I have envisioned is something similar to > emacs search, i.e. it highlights all the occurrences of the keyword &g...

Re: (fwd) Predictive text entry widget #2
Hello, I've been playing with this code for a predictive text entry widget, and have come up with the following code (for a "mozilla" style selection of predictions). My problem is that the entry widget often loses the focus when the menu changes, and I don't understand why. Sometimes I also get the message: TkFocusKeyEvent found dispPtr->focusPtr out of sync: expected ??, got .menu Could someone help me to understand this (please excuse my mediocre coding!)? I'm running it under RH7.3 and KDE3.0. Thanks, Matt -- #!/usr/local/bin/perl -w u...

Web resources about - RE: text in a widget, text-widget @ 1146167556 #2 - comp.lang.perl.tk

Favorites Widget - Call & Text from the Notification Center on the App Store on iTunes
Get Favorites Widget - Call & Text from the Notification Center on the App Store. See screenshots and ratings, and read customer reviews.

Apple takes aim at the iOS 8 Notification Center widget from popular text capture app Drafts 4
Nearly three months after launching iOS 8, Apple is still fine tuning what developers can do with the new functionality.

App Watch: Plain old text and widgets
App Watch: Plain old text and widgets

Minimalist Text is Your All-in-one Widget Option
Is Minimalist Text the best minimalist app we’ve seen yet? That’s tough to say, but we definitely think it’s worth mentioning and giving a ton ...

7 Great text-based widgets, for those that would rather read their home screen
7 Great text-based widgets, for those that would rather read their home screen

Widget Watch: Mac ASCII Text with Figlet
Continuing on with what has turned into ASCII Sunday here at TUAW, a comment from Micah Cooper led me to FIGlet, which has been around roughly ...

Heapo Clipboard Management Widget - copy & paste text, photo and URL instantly also view, clear and sync ...
Get Heapo Clipboard Management Widget - copy & paste text, photo and URL instantly also view, clear and sync your clipboard with your desktop/mac/window ...

Apple takes aim at the iOS 8 Notification Center widget from popular text capture app Drafts 4
... decided that yet another iOS 8 Notification Center widget needs to be modified. Agile Tortoises Greg Pierce, developer of the popular text ...

Resources last updated: 2/6/2016 12:31:11 AM