use Tk; use Tk::Adjuster; $mw = MainWindow->new(-title => "My Adjuster Example"); $mw->resizable( 0, 0 ); # not resizable in any direction $listboxesFrame = $mw->Frame(); $mfLbScrollBar = $listboxesFrame->Scrollbar(-orient=>'v'); $mfItemNameLb = $listboxesFrame->Listbox(-height => 25); $adj1 = $listboxesFrame->Adjuster(); $mfItemCurrentBubbleLb = $listboxesFrame->Listbox(-height => 25); $adj2 = $listboxesFrame->Adjuster(); $mfItemOtherBubbleLb = $listboxesFrame->Listbox(-height => 25); # Array of the three Listboxes $mfListBoxes = [ $mfItemNameLb, $mfItemCurrentBubbleLb, $mfItemOtherBubbleLb ]; # Configure each Listbox to call &scroll_listboxes foreach $list (@$mfListBoxes) { $list->configure(-yscrollcommand => [ \&scroll_listboxes, $mfLbScrollBar, $list, $mfListBoxes ]); } # Configure the Scrollbar to scroll each Listbox $mfLbScrollBar->configure(-command => sub { foreach $list (@$mfListBoxes) { $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 => 'both'); $mfLbScrollBar->pack(-side => 'right', -fill => 'y'); $listboxesFrame->grid(-row=>1,-column=>1, -padx => 10, -pady => 10); MainLoop; sub scroll_listboxes { my ($sb, $scrolled, $lbs, @args) = @_; $sb->set(@args); # tell the Scrollbar what to display my ($top, $bottom) = $scrolled->yview( ); foreach $list (@$lbs) { $list->yviewMoveto($top); # adjust each lb } }