home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeMastering Perl/TkSearch this book

7.17. 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 Scrollbar Widget".

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, "Anatomy of the MainLoop".

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.