Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Tk: Make lines disappear in a Text widget?

by converter (Priest)
on Oct 09, 2003 at 17:46 UTC ( #298020=note: print w/ replies, xml ) Need Help??


in reply to Tk: Make lines disappear in a Text widget?

Invoke tagConfigure with the -state parameter, with a value 'hidden'. When this tag is added to a range, the text will not be displayed in the text widget. Invoking tagRemove with the tag name and range will make the text visible again.

# A quick demo: hide the selected text, # press the Escape key to make hidden # text visible again $mw = tkinit; $t = $mw->Text->pack; $t->tagConfigure( 'hide', -state => 'hidden', ); $b = $mw->Button( -text => 'Hide', -command => \&hide_text, )->pack; $mw->bind('<Escape>', \&show_text); MainLoop; sub show_text { my @r = $t->tagRanges('hide'); return unless @r; $t->tagRemove('hide', @r); return; } sub hide_text { my @r = $t->tagRanges('sel'); return unless @r; $t->tagAdd('hide',@r); return; }


Comment on Re: Tk: Make lines disappear in a Text widget?
Select or Download Code
Replies are listed 'Best First'.
Re: Re: Tk: Make lines disappear in a Text widget?
by bschmer (Friar) on Oct 09, 2003 at 18:25 UTC
    Must be the version of Tk that I'm using. I'll update to the latest and try again.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://298020]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2015-07-31 04:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls