Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Perl TK: Can a parent be made aware that a child has been modified

by zentara (Archbishop)
on Dec 15, 2012 at 10:44 UTC ( #1008968=note: print w/ replies, xml ) Need Help??


in reply to Perl TK: Can a parent be made aware that a child has been modified

Since you didn't show a simple code example, here is one. I am binding to the $mw here, but you can also bind to a widget of your choice.

#!/usr/bin/perl use Tk; my $mw = new MainWindow; my $canvas = $mw->Canvas(-bg=>'white')->pack(-expand=>1, -fill => 'bot +h'); my $currentSize = $mw->reqwidth . "x" . $mw->reqheight; $mw->bind( '<Configure>', [ \&OnResize, \$currentSize ] ); MainLoop; sub OnResize { my ( $mw, $oldSize ) = @_; my $newSize = $mw->width . "x" . $mw->height; if ( $$oldSize ne $newSize ) { ## Resize has occurred do something: printf( "Resize happened - old size: %s, new size: %s\n", $$oldSize, $newSize ); ## set the old size to the new size $$oldSize = $newSize; } }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh


Comment on Re: Perl TK: Can a parent be made aware that a child has been modified
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (15)
As of 2015-07-29 11:36 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 (263 votes), past polls