Well you didn't show an example, but the scrollbar widget can be tricky. You can get the to the scrollbar subwidget and try to configure it, but you may run into glitches, because the 'osoe' is usually what people want, and if you want to fiddle with it, be prepared for automatic update problems.

The Scrolled Pane widget, is almost always better to use than the Scrolled Frame, so switch to a Scrolled Pane and see if that works better for you. But here is an example of detecting Frame size (then you can try to configure the scrollbars manually), otherwise show us an example of what you are trying to accomplish.

#!/usr/bin/perl use Tk; #also check out the Pane widget. use Tk::Frame; use Tk::Canvas; use Tk::Button; my $mw = new MainWindow; my $sc = $mw->Scrolled( 'Canvas', -bg => 'black', -scrollbars => 'w', ); my $sf = $sc->Frame( -background => 'Yellow' ); foreach ( 1 .. 100 ) { my $subframe = $sf->Frame(); my $lbl = $subframe->Label( -text => "Entry $_" ) ->pack( -side => 'left', -fill => 'x' ); my $txt = $subframe->Entry()->pack( -side => 'right', -fill => 'x' + ); $subframe->pack( -side => 'top', -fill => 'x' ); } # Find the required width / height of our frame... $sf->update; # forces geometry requests to propagate my $f_req_w = $sf->reqwidth; my $f_req_h = $sf->reqheight; print "- Frame needs $f_req_w by $f_req_h\n"; # Configure the scrolled canvas for a best fit... $sc->configure( -scrollregion => [ 0, 0, $f_req_w, $f_req_h ], -width => $f_req_w ); $sc->createWindow( 0, 0, -anchor => 'nw', -window => $sf, -height => $f_req_h, -width => $f_req_w, ); $sc->pack( -expand => 1, -fill => 'both' ); Tk::MainLoop; __END__
If you really want to have absolute control over the scrollbars, you should manually make them, and link them to your widget-to-be-scrolled.
#!/usr/bin/perl use warnings; use strict; use Tk; my $list; my $parent; my $mw = MainWindow->new(); $mw->title("Listbox"); $mw->geometry("600x300+100+100"); $mw->Button( -text => "Exit", -command => sub { exit } )->pack( -side => 'bottom', -fill => 'x' ); $parent = $mw->Listbox()->pack( -side => 'left', -fill => 'y', -expand + => 1 ); my $yscroll = $parent->Scrollbar(-orient => 'vertical'); my $listboxes = [ $parent->Listbox(), $parent->Listbox(), $parent->Listbox(), $parent->Listbox(), ]; foreach $list (@$listboxes) { $list->configure( -yscrollcommand => [ \&scroll_listboxes, $yscroll, $list, $li +stboxes ], ); } $yscroll->configure( -command => sub { foreach $list (@$listboxes) { $list->yview(@_); } } ); $yscroll->pack( -side => 'left', -fill => 'y' ); my $count = 0; foreach $list (@$listboxes) { $list->insert( 'end', "one-$count", "two-$count", "three-$coun +t", "four-$count", "five-$count", "six-$count", "seve +n-$count", "eight-$count", "nine-$count", "ten-$count", "elev +en-$count", "twelve-$count", "thirteen-$count", "fourteen-$count", "fift +een-$count", "sixteen-$count", "seventeen-$count", "eighteen-$count", "nine +teen-$count", "twenty-$count" ); $count++; $list->pack( -side => 'left', -fill => 'y', -expand => 1 ); } MainLoop; sub scroll_listboxes { my ( $sb, $scrolled, $lbs, @args ) = @_; $sb->set(@args); my ( $top, $bottom ) = $scrolled->yview(); foreach $list (@$lbs) { $list->yviewMoveto($top); } } __END__

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

In reply to Re: How do I configure the optional property of a scrollbar? by zentara
in thread How do I configure the optional property of a scrollbar? by ravz

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.