O'Reilly logo

Mastering Perl/Tk by Nancy Walsh, Stephen Lidie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Scrolling Methods

The Listbox can be scrolled both horizontally and vertically so it has both xview and yview methods and all their associated forms. These forms and how to use them are described in detail in Chapter 6.

The scan method allows you to use a really fast scrolling method. It is automatically bound to the second mouse button by the Listbox. Here is how you can do the same thing within your window:

$mw->bind("Listbox", "<2>",['scan','mark',Ev('x'),Ev('y')]);
$mw->bind("Listbox", "<B2-Motion>",['scan','dragto',Ev('x'),Ev('y')]);

When you click in the window with the second mouse button and then move your mouse around, you’ll see the contents of the Listbox zip by at super-fast speed. You could change the second argument of each bind statement if you wanted to bind this to another combination of keys/mouse actions. The bind method is explained in Chapter 15.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required