Hi Tim,
keep the scrollbar outside of the frame that holds the adjusted widgets:
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::Adjuster;
my $mw = MainWindow->new(-title => "My Adjuster Example");
$mw->resizable( 0, 0 ); # not resizable in any direction
my $listboxesFrame = $mw->Frame();
my $mfLbScrollBar = $mw->Scrollbar(-orient=>'v');
my $mfItemNameLb = $listboxesFrame->Listbox(-height => 25);
my $adj1 = $listboxesFrame->Adjuster();
my $mfItemCurrentBubbleLb = $listboxesFrame->Listbox(-height => 25);
my $adj2 = $listboxesFrame->Adjuster();
my $mfItemOtherBubbleLb = $listboxesFrame->Listbox(-height => 25);
# Array of the three Listboxes
my $mfListBoxes = [ $mfItemNameLb, $mfItemCurrentBubbleLb, $mfItemOthe
+rBubbleLb ];
# Configure each Listbox to call &scroll_listboxes
foreach my $list (@$mfListBoxes) {
$list->configure(-yscrollcommand => [ \&scroll_listboxes, $mfLbScrol
+lBar,
$list, $mfListBoxes ]);
}
# Configure the Scrollbar to scroll each Listbox
$mfLbScrollBar->configure(-command => sub { foreach my $list (@$mfList
+Boxes) {
$list->yview(@_);
}});
$mfItemNameLb->pack(-side => 'left', -expand => 1, -fill => 'both');
$adj1->packAfter($mfItemNameLb, -side => 'left');
$mfItemCurrentBubbleLb->pack(-side => 'left', -expand => 1, -fill => '
+both');
$adj2->packAfter($mfItemCurrentBubbleLb, -side => 'left');
$mfItemOtherBubbleLb->pack(-side => 'left', -expand => 1, -fill => 'bo
+th');
$mfLbScrollBar->pack(-side => 'right', -fill => 'y');
$listboxesFrame->pack(-side => 'left', -fill => 'y');
MainLoop;
sub scroll_listboxes {
my ($sb, $scrolled, $lbs, @args) = @_;
$sb->set(@args); # tell the Scrollbar what to display
my ($top, $bottom) = $scrolled->yview( );
foreach my $list (@$lbs) {
$list->yviewMoveto($top); # adjust each lb
}
}
Cheers, Chris