example yourscript.pl
Your modules here
use Tk;
use Tk::Scrollbar;
Your code here...
at then copy
# ##################################################################
# Package Scrollbar
# ##################################################################
package Tk::Frame;
sub AddScrollbars
{
# require Tk::Scrollbar; # changed
my ($cw,$w) = @_;
my $def = '';
my ($x,$y) = ('','');
my $s = 0;
my $c;
$cw->freeze_on_map;
foreach $c ($w->configure)
{
my $opt = $c->[0];
if ($opt eq '-yscrollcommand')
{
my $slice = Tk::Frame->new($cw,Name => 'ysbslice');
my $ysb = Tk::Scrollbar->new($slice,-orient => 'vertical', -command =>
[ 'yview', $w ]);
my $size = $ysb->cget('-width');
my $corner = Tk::Frame->new($slice,Name=>'corner','-relief' => 'raised',
'-width' => $size, '-height' => $size);
$ysb->pack(-side => 'left', -fill => 'y');
$cw->Advertise('yscrollbar' => $ysb);
$cw->Advertise('corner' => $corner);
$cw->Advertise('ysbslice' => $slice);
$corner->{'before'} = $ysb->PathName;
$slice->{'before'} = $w->PathName;
$y = 'w';
$s = 1;
}
elsif ($opt eq '-xscrollcommand')
{
my $xsb = Tk::Scrollbar->new($cw,-orient => 'horizontal', -command => [
'xview', $w ]);
$cw->Advertise('xscrollbar' => $xsb);
$xsb->{'before'} = $w->PathName;
$x = 's';
$s = 1;
}
}
if ($s)
{
$cw->Advertise('scrolled' => $w);
$cw->ConfigSpecs('-scrollbars' => ['METHOD','scrollbars','Scrollbars',$x.$y]);
}
}
# end of Tk::Frame::AddScrollbars
# copied from freeze_on_map.al
sub freeze_on_map
{
my ($w) = @_;
unless ($w->Tk::bind('Freeze','<Map>'))
{
$w->Tk::bind('Freeze','<Map>',['packPropagate' => 0])
}
$w->AddBindTag('Freeze');
}
# end of Tk::Frame::freeze_on_map
# copied from scrollbars.al
sub scrollbars
{
my ($cw,$opt) = @_;
my $var = \$cw->{'-scrollbars'};
if (@_ > 1)
{
my $old = $$var;
if (!defined $old || $old ne $opt)
{
$$var = $opt;
$cw->queuePack;
}
}
return $$var;
}
# end of Tk::Frame::scrollbars
# copied from queuePack.al
#line 194 "blib\lib\Tk\Frame.pm (autosplit into blib\lib\auto\Tk\Frame\queuePack.al)"
sub queuePack
{
my ($cw) = @_;
unless ($cw->{'pack_pending'})
{
$cw->{'pack_pending'} = 1;
$cw->afterIdle([$cw,'packscrollbars']);
}
}
# end of Tk::Frame::queuePack
# copied from packscrollbars.al
#line 265 "blib\lib\Tk\Frame.pm (autosplit into blib\lib\auto\Tk\Frame\packscrollbars.al)"
sub packscrollbars
{
my ($cw) = @_;
my $opt = $cw->cget('-scrollbars');
my $slice = $cw->Subwidget('ysbslice');
my $xsb = $cw->Subwidget('xscrollbar');
my $corner = $cw->Subwidget('corner');
my $w = $cw->Subwidget('scrolled');
my $xside = (($opt =~ /n/) ? 'top' : 'bottom');
my $havex = 0;
my $havey = 0;
$opt =~ s/r//;
$cw->{'pack_pending'} = 0;
if (defined $slice)
{
my $reqy;
my $ysb = $cw->Subwidget('yscrollbar');
if ($opt =~ /(o)?[we]/ && (($reqy = !defined($1)) || $ysb->Needed))
{
my $yside = (($opt =~ /w/) ? 'left' : 'right');
$slice->pack(-side => $yside, -fill => 'y',-before => $slice->{'before'});
$havey = 1;
if ($reqy)
{
$w->configure(-yscrollcommand => ['set', $ysb]);
}
else
{
$w->configure(-yscrollcommand => ['sbset', $cw, $ysb,
\$cw->{'packysb'}]);
}
}
else
{
$w->configure(-yscrollcommand => undef) unless $opt =~ s/[we]//;
$slice->packForget;
}
$cw->{'packysb'} = $havey;
}
if (defined $xsb)
{
my $reqx;
if ($opt =~ /(o)?[ns]/ && (($reqx = !defined($1)) || $xsb->Needed))
{
$xsb->pack(-side => $xside, -fill => 'x',-before => $xsb->{'before'});
$havex = 1;
if ($reqx)
{
$w->configure(-xscrollcommand => ['set', $xsb]);
}
else
{
$w->configure(-xscrollcommand => ['sbset', $cw, $xsb,
\$cw->{'packxsb'}]);
}
}
else
{
$w->configure(-xscrollcommand => undef) unless $opt =~ s/[ns]//;
$xsb->packForget;
}
$cw->{'packxsb'} = $havex;
}
if (defined $corner)
{
if ($havex && $havey && defined $corner->{'before'})
{
my $anchor = $opt;
$anchor =~ s/o//g;
$corner->configure(-height => $xsb->ReqHeight);
$corner->pack(-before => $corner->{'before'}, -side => $xside,
-anchor => $anchor, -fill => 'x');
}
else
{
$corner->packForget;
}
}
}
# end of Tk::Frame:

ackscrollbars
Everything inside your perl script
dmazzini
GSM System and Telecomm Consultant