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

Hi,
could someone please enlighten me on why oh why the scrollbar in code below is NOT adjusted properly?
What that happens is that the frame below the scrollbar (underneath, so to speak) gets resized instead...

use strict; use Tk; my $mw = MainWindow->new; my $t = $mw->Scrolled('Text',-scrollbars => 'se', -wrap=>'none')-> +pack; #Works $t->Subwidget('text')->configure(-bg => 'grey'); #Does not work $t->Subwidget('yscrollbar')->configure(-width =>24); MainLoop;

on winxp, perl 5.8.3-809

Many Thanks.

Replies are listed 'Best First'.
Re: scrolled text scrollbars configure
by zentara (Cardinal) on Oct 01, 2004 at 12:59 UTC
    Just in case you were wondering, your script works fine on linux.

    I'm not really a human, but I play one on earth. flash japh
Re: scrolled text scrollbars configure
by Grygonos (Chaplain) on Oct 01, 2004 at 14:33 UTC

    Scrollbars option need to read thusly

    my $t = $mw->Scrolled('Text',-scrollbars => 'oe os', -wrap=>'none')->p +ack;
    This does all of what you want. It makes scrollbars appear when needed on south and east sides of the box.. if they are not needed they will not be visible. You will probably get a warning everyime one of those is displayed, that you are using a bad anchor, but in fact you are not.. this is in the Scrolled widget by design I believe.

      1) I don't want optional scrollbars on the text-widget and 2)once the optional scrollbars "pops out" the same problem as before occours. :/

      Thanks for suggestion, btw..

        I see what you want now... and I can tell you that the width thing does not work on Windows XP perl 5.8.0 I tried it using direct scrollbars rather than Scrolled widgets and they display the same behavior as the scrolled... the panel gets bigger.. not the actual scroller.

Re: scrolled text scrollbars configure
by gothic_mallard (Pilgrim) on Oct 01, 2004 at 13:22 UTC

    Running the above code (Activeperl 5.6.1 (633)) on WinXP does indeed do what you say - what's interesting is that if you resize the window smaller using the bottom or bottom left edges the scrollbar expands to fill the space as it should.

    Updated Steve_p - changed node title from "Re:"

      Tried it on perl 5.8.4-810 and same problem.
      For some strange reason this works:

      use strict; use Tk; my $mw = MainWindow->new; my $t = $mw->Scrolled('Text',-scrollbars => 'se', -wrap=>'none')-> +pack; #Works $t->Subwidget('text')->configure(-bg => 'grey'); #Does not work #$t->Subwidget('yscrollbar')->configure(-width =>24); $mw->after(100, sub {$t->Subwidget('yscrollbar')->configure(-width + =>44);$mw->update;}); MainLoop;

      Can't go any lower than 100ms on the timer, then it doesn't work..therefore the resize of the scrollbar is clearly visible in the mainwindow..

      annoying..Can i spit?

      Update:Ok..seems like timer be lowered down to 40ms..which makes change less visible..