RESIZING PANES
A pane is resized by grabbing the sash (or sash handle if present) and
+ dragging
with the mouse. This is accomplished via mouse motion bindings on the
+ widget. When a sash is moved, the sizes of the panes on each side o
+f the sash, and thus the widgets in thosepanes, are adjusted.
When a pane is resized from outside (eg, it is packed to expand and fi
+ll, and the containing toplevel is resized), space is added to the fi
+nal (rightmost or bottommost) pane in the window.
An example:
#!/usr/bin/perl -w
use strict;
use Tk;
my @scrollregion = (0,0,500,500);
my $mw=tkinit;
my $windowpane = $mw->Panedwindow(
-orient => 'vertical' )
->pack(
-side => 'top' ,
-expand => 1,
-fill => 'both' );
my $firstframe=$mw->Frame();
my $secondframe=$mw->Frame();
my $cf=$firstframe->Scrolled(
'Canvas',
-bg=>'red',
-scrollregion=>\@scrollregion,
-confine=>1,
-scrollbars=>'se')
->pack(-expand=>1, -fill=>'both', -anchor=>'nw');
$cf->create('rectangle',0,0,500,500);
my $statusbar = $firstframe->Label(
-text=>"This is a statusbar")
->pack(-fill=>'x', -expand=>0);
my $tw = $secondframe->Scrolled(
'Text',
-scrollbars=>'osoe')
->pack(-fill=>'both', -expand=>1, -anchor=>'nw');
$windowpane->add($firstframe, -sticky=>'nsew');
$windowpane->add($secondframe, -sticky=>'nsew');
$windowpane->bind( '<Configure>' => \&OnResize );
$mw->bind( '<Configure>' => \&OnResize );
MainLoop;
sub OnResize{
my ($newx,$newy) = ($mw->width, $mw->height);
$cf->configure( -scrollregion=>[0,0,$newx,$newy]);
}
#########################################################
|