Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Tk::Scrollbar don't know how to use it properly

by zentara (Archbishop)
on Sep 11, 2014 at 09:58 UTC ( [id://1100278]=note: print w/replies, xml ) Need Help??


in reply to Tk::Scrollbar don't know how to use it properly

When you manually make Scrollbars, you must define what they do. Use a Tk::Scrolled widget if you want automatic scrolling. Sometimes, an short example is worth 10,000 words. See Re: I seek illumination and knowledge or
#!/usr/bin/perl ########## use Tk; use strict; my $mw=tkinit; my $c=$mw->Scrolled('Canvas', -width=>400, -height=>400, -bg=>'red', -scrollregion=>[0,0,1000,1000], -scrollbars=>'se')->pack(-expand=>1, -fill=>'both'); $c->create('rect',&n) for (0..40); my $id = $mw->repeat(100,sub{ $c->xviewScroll(1,'units'); $c->yviewScroll(1,'units'); }); $mw->after(10000, sub{$id->cancel}); MainLoop; sub n { my ($x1,$y1) = ( rand(1000), rand(1000) ); my ($x,$y) = ($x1/2,$y1/2); return ($x,$y,$x1,$y1); }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1100278]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-23 13:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found