For your first post, you chose a whopper of a question....how to link nested scrolled widgets.

First use warnings and use strict.

Second this is kind of complex to answer, because Scrolled widgets do some internal magical linking, so trying to orchestrate them all together, and still allow them to work independently, is intricate.(More than I care to sweat over this afternoon :-)) You may be better off building ALL your widgets with manual scrollbars, then somehow juggling everything.

But here is a start with a ScrolledPane. The only glitch is that the master scrollbar only works when you hit the up or down arrow graphics (which move things 1 unit in that direction). If you try to drag the green bar, everything resets to the master yview.

If it was me, I would ditch the master scrollbar,and make custom labels with up/down arrows to replace the master scrollbar, and just have them do a + or - 1 unit increment, instead of the yview(@_). In other words, use a Pane, instead of the ScrolledPane, and pack a frame on the left, with an up and down label. Link each label's mouse 1 click to scroll 1 unit in all Scrolled Listboxes.

But if you are persistent and clever, you may be able to setup a yscrollcommand that dosn't reset all listboxes to the @_ of the yscrollbar, but it's up to you, or someone else may know the trick.

#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Pane; my $mw = MainWindow->new(); $mw->geometry("600x300+100+100"); $mw->Button( -text => "Exit", -command => sub { exit } )->pack( -side => 'bottom', -fill => 'x' ); my $parent = $mw->Scrolled('Pane' ) ->pack( -fill => 'both', -expand => 1 ); my $yscroll = $parent->Subwidget('yscrollbar'); my @listboxes; foreach my $num (1..4) { my $list = $parent->Scrolled('Listbox'); foreach my $num (1..100){ $list->insert( 'end', $num); } $list->pack( -side => 'left', -fill => 'y', -expand => 1 ); push @listboxes, $list; } $yscroll->configure( -background => "lightgreen", -troughcolor => "black", -command => sub { foreach my $list (@listboxes) { $list->yview(@_); # $list->yviewScroll(1,'units'); } }, ); MainLoop;

I'm not really a human, but I play one on earth Remember How Lucky You Are

In reply to Re: How to Scroll multiple Frames using Tk::Pane by zentara
in thread How to Scroll multiple Frames using Tk::Pane by ravishi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.