Here's a simple example using two frames that contain a Listbox and a Text widget, respectively:
use Tk; use Tk::Adjuster; $mw = MainWindow->new(-title => "Adjuster example"); $leftf = $mw->Frame->pack(-side => 'left', -fill => 'y'); $adj = $mw->Adjuster(-widget => $leftf, -side => 'left') ->pack(-side => 'left', -fill => 'y'); $rightf = $mw->Frame->pack(-side => 'right', -fill => 'both', -expand => 1); # Now put something into our frames. $lb = $leftf->Scrolled('Listbox', -scrollbars => 'osoe') ->pack(-expand => 1, -fill => 'both'); $lb->insert('end', qw/normal bold italics code command email emphasis emphasisBold Filename FirstTerm KeyCode KeySymbol/); $rightf->Scrolled('Text', -scrollbars => 'osoe') ->pack(-expand => 1, -fill => 'both'); MainLoop;
You can see in Figure 23-11 that the thin line with the small box at the bottom is our adjuster. If you hover your mouse over the line, the cursor will change to a horizontal double-ended arrow, indicating you can click and drag. As you drag to the right, the Listbox becomes larger. As you drag to the left, the Listbox becomes smaller.
Instead of calling pack on the Adjuster widget, you can call packAdjust, which shortens your argument list and eliminates having to use any pack-specific options:
$adj1->packAdjust($leftf, -side => 'left');
The options you can use to customize the Adjuster include:
Copyright © 2002 O'Reilly & Associates. All rights reserved.