O'Reilly logo

Learning Perl/Tk by Nancy Walsh

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

14.3. Defining Event Sequences

So far, you've seen several different event sequences—<Button-3>, <Button-1>, and <Return> —but I haven't yet explained the format for building them. Although the examples you've seen may seem obvious and simple, event sequences can get much more complicated.

The event sequence is built from an optional modifier, an event, and an optional detail. They are separated by dashes and then placed between angle brackets:

<modifier-event-detail>

As we discuss all the possible bindings, keep in mind that it is possible for more than one event sequence to match. The more detailed matches will invoke their callbacks first. If a binding has been created on a specific button, and then another binding is created on all of the buttons, the specific-button bind callback will be invoked first, and then the more general all-button bind callback will be invoked.

14.3.1. Modifiers

A modifier is an event that happens at the same time the main event happens, such as holding down the Control key and clicking the mouse. The modifying event must happen first in order for the entire event sequence to match (e.g., pressing the Control key and then pressing the mouse button).

The possible modifiers and their meanings are as follows:

Control

The Control key must be pressed down as the main event is happening (e.g., <Control-Button-1>).

Shift

The Shift key must be pressed down as the main event happens (e.g., <Shift-Button-3>).

Lock

The Caps Lock key must be pressed to turn ...

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