Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks , how do you control the Scorll's hight when using ::Tk , My scorll's menue comes longer than needed. I am doing the following:
$t = $mw->Scrolled("Text", -width => 35, -wrap => 'none')->pack(-expand => 1, -fill => 'both +'); foreach (qw/ Order1 Order2 Order3 Order4 Total/) { $w = $t->Label(-text => "$_:", -relief => 'groove', -width => +20); $t->windowCreate('end', -window => $w); $w = $t->Entry(-width => 20, -textvariable => \$info{$_}); $t->windowCreate('end', -window => $w); $t->insert('end', "\n"); } $t->configure(-state => 'disabled');
I only have five entries but when the menue get loaded , it will have big empty space at the bottom . thanks

Replies are listed 'Best First'.
Re: Tk: How do you control the height of a Scroll?
by arden (Curate) on Mar 02, 2004 at 05:06 UTC
    I would suggest you try manually using the set command, although it may be that your list is so short that Tk pads the white-space just to meet the built-in minimums for a scrollbar.

    Try this:    $t->set(.05,.95);

    You can find out what these values are right now by using     ($first, $last) = $t->get(); and then printing out the values returned.

    - - arden.

Re: Tk: How do you control the height of a Scroll?
by mawe (Hermit) on Mar 02, 2004 at 06:24 UTC
    Hi!

    If I understand you right, -height could be what you want:

    $t = $mw->Scrolled("Text", -width => 35, -height=>7, -wrap => 'none', )->pack(-expand => 1, -fill => 'both');
      nice , thanks
        Note that you wanted to control the size of the scrollable region, not the size of the bar, so that is why you mess with Tk::Scrolled.

        Tk::Scrolled is an uber-container, not the the little thing you click on with your mouse to move the bar back and forth. If you adjust the width on that, it makes the bar narrower but does not affect the size of the region.