CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Tk::Text

 



Rivotti
User

Oct 16, 2001, 8:22 AM

Post #1 of 2 (853 views)
Tk::Text Can't Post

Hi...

How can I insert/change text inside a text box?
For example I'va initialize the texto box like this:

$TEXT = $main->Text(-height => 200, -width => 200, -wrap => 'word', -font => 'Currier')->pack;

Now, I've tried this in a Button command:

$TEXT->configure( -font => 'Arial');

This works but... it changes all the text. What I need is to change only the selected text.
Another thing, how to insert text in the textbox?

Thanks in advance
Rivotti

André Rivotti Casimiro
Web Designer/Programmer
CONTIFAX.COM
http://www.contifax.com


thodi
stranger

Nov 8, 2001, 3:04 AM

Post #2 of 2 (833 views)
Re: Tk::Text [In reply to] Can't Post

I hope this is still useful, even though your post is rather old ...

Tk::Text widgets support a feature called 'Tags', which are formats that you can apply to parts of the Text's contents. Simply define a tag with the properties you need, and apply the tag to the currently selected text:

Code
$TEXT->tagConfigure('arial', -font => 'Arial'); 
...
$TEXT->tagAdd('arial', 'sel.first', 'self.last') if $TEXT->tagRanges('sel');

You can insert text by calling the insert(position, text) function. position can be 'end', 'linenumber.charnumber', ...


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives