Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Perl Tk Scrolled widget callbacks

by thundergnat (Deacon)
on Mar 01, 2013 at 16:56 UTC ( #1021298=note: print w/replies, xml ) Need Help??

in reply to Perl Tk Scrolled widget callbacks

It should be possible to hook into the <<MenuSelect>> virtual event bound to the popup menu but I am having a hard time figuring out how to do so...

Another less elegant way is to just poll the state of the -wrap option and do your callback when it changes.

use warnings; use strict; use Tk; my $mw = new MainWindow; $mw->geometry("200x200"); my $frame = $mw->Frame()->pack; my $textbox = $frame->Scrolled('Text', -scrollbars => 'soe', -foreground => 'blue', -background => 'white', -wrap => 'none', )->pack; $textbox->insert('end', "This is scrolled widget.\nThis is scrolled wi +dget.This is scrolled widget"); my $wrapmonitor = $textbox->cget('wrap'); $textbox->repeat(100, sub { if ( $textbox->cget('wrap') ne $wrapmonitor ){ $wrapmonitor = $textbox->cget('wrap'); mycallback($wrapmonitor) #whatever } } ); MainLoop; sub mycallback { print shift, "\n"; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021298]
[james28909]: /msg [beech] that was it. i reset everything to default and it fixed it. now to figure out exactly what was causing it!
[james28909]: good lord :(
[Lady_Aleena]: james28909, bare name...
[james28909]: /msg username message did it
[LanX]: James not /msg [beech] but /msg beech
[james28909]: i havent used the /msg [username] message</c> format
[LanX]: you can also click on beech and message him. ..
[james28909]: jebus
[LanX]: sorry again not [msg://beech]

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-05-24 22:50 GMT
Find Nodes?
    Voting Booth?