Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 musing on the Monastery: (7)
As of 2014-12-28 19:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls