What you can also add is code to watch for the resize event, occuring while the Frames are unpacked. You can keep a running array of the current window size.
It seems to me that repacking your children into larger frames might be accomplished by using -fill=>both -expand=>1 in the packing, and then calling the packPropagate command.... but that is untested.
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
my $mw = new MainWindow;
my $current_size = $mw->reqwidth . "x" . $mw->reqheight;
my $old_current_size = $current_size;
$mw->bind( '<Configure>', sub{ &OnResize });
my $leave = 0;
$mw->bind( '<Leave>',sub { $leave = 1; } );
$mw->bind( '<Enter>',sub { $leave = 0;
&OnResize;
} );
MainLoop;
sub OnResize {
my $current_size = $mw->width . "x" . $mw->height;
if( $leave == 1) {return }
if($old_current_size eq $current_size){return}
## Resize has occurred do something:
printf( "Resize happened - old size: %s, new size: %s\n",
$old_current_size, $current_size );
## set the old size to the new size
$old_current_size = $current_size;
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|