Re: About scroll bar

"Jen Spinney" <[email protected]> Sat, 9 Sep 2006 22:57:09 -0400
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
On 9 Sep 2006 18:42:07 -0000, jeevitesh <[email protected]> wrote:
>
>
>
> Dear friends,
>
>                     I have a simple problem Need your help. I possess number widget like Text widget, label and  button in a single window so naturally my Text Area widget is smaller one, but when I add Scroll bar to my Text widget the scroll bar is getting added for the entire window.
>
> The source code
>
>
> $mw1=MainWindow->new();
>
> $scrollbar3 =$mw1->Scrollbar(-orient=>'horizontal');
>
>  $Text3 = $mw1->Text(-background => '#a0b7ab',-foreground => 'black',-width =>
>
>  85,-height=>6,-font=>"-*-Courier-Medium-B-Normal--*-120-*-*-*-*-*-*",-wrap => "none",xscrollcommand =>
>
>
> ['set',$scrollbar3] )->place( -x => 200, -y => 300);
>
>
> $mw1->minsize(qw(550 500));
>
> $mw1->geometry('+350+200');
Hi Jeevitesh,

Does this do what you want?

use strict;
use warnings;
use Tk;

my $mw1=MainWindow->new();

my $scrollbar3=$mw1->Scrolled
    (
     'Text',
     -background => '#a0b7ab',
     -foreground => 'black',
     -width      => 85,
     -height     => 6,
     -font       => "-*-Courier-Medium-B-Normal--*-120-*-*-*-*-*-*",
     -wrap       => "none",
     -scrollbars => 's',
     ) -> place( -x=>200, -y=>300);

$mw1->minsize(qw(550 550));

$mw1->geometry('+350+200');

MainLoop;


The line " -scrollbars => 's', " sets a mandatory scrollbar on the
'south' (bottom) side of the text widget.  If you want the scrollbar
to only show up when needed, set -scrollbars to 'os' for optional
south.  I combined the scrollbar widget and the text widget together
into the Scrolled megawidget.

-Jen
--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/ptk