Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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; }

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?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2021-04-15 11:59 GMT
Find Nodes?
    Voting Booth?

    No recent polls found