O'Reilly logo

Practical Programming in Tcl & Tk, Third Edition by Brent B. Welch

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

Event Sequences

The bind command accepts a sequence of events in a specification, and most commonly this is a sequence of key events. In the following examples, the Key events are abbreviated to just the character detail, and so abc is a sequence of three Key events:

bind . a {puts stdout A}
bind . abc {puts stdout C}

With these bindings in effect, both bindings are executed when the user types abc. The binding for a is executed when a is pressed, even though this event is also part of a longer sequence. This is similar to the behavior with Double and Triple event modifiers. For this reason you must be careful when binding sequences. You can use break in the binding for the prefix to ensure that it does not do anything:

 bindtags $w [list $w ...

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