www.gibmonks.com




  Previous section   Next section

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

Table of Contents
Chapter 26.  Binding Commands to Events


Event Keywords

Table 26-4 lists the percent keywords and the corresponding option to the event generate command. Remember that keyword substitutions occur throughout the command, regardless of other Tcl quoting conventions. Keep your binding commands short, introducing procedures if needed. For the details about various event fields, consult the Xlib Reference Manual (O'Reilly & Associates, Inc.). The string values for the keyword substitutions are listed after a short description of the keyword. If no string values are listed, the keyword has an integer value like a coordinate or a window ID.

Table 26-4. A summary of the event keywords.
%% Use this to get a single percent sign. All events.
%#-serial numThe serial number for the event. All events.
%a-above winThe above field from the event. Configure event.
%b-button numButton number. Events: ButtonPress and ButtonRelease.
%c-count numThe count field. Events: Expose and Map.
%d-detail valueThe detail field. Values: NotifyAncestor, NotifyNonlinearVirtual, NotifyDetailNone, NotifyPointer, NotifyInferior, NotifyPointerRoot, NotifyNonlinear, or NotifyVirtual. Events: Enter, Leave, FocusIn, and FocusOut.
%f-focus booleanThe focus field (0 or 1). Events: Enter and Leave.
%h-height numThe height field. Events: Configure and Expose.
%k-keycode numThe keycode field. Events: KeyPress and KeyRelease.
%m-mode valueThe mode field. Values: NotifyNormal, NotifyGrab, NotifyUngrab, or NotifyWhileGrabbed. Events: Enter, Leave, FocusIn, and FocusOut.
%o-override booleanThe override_redirect field. Events: Map, Reparent, and Configure.
%p-place valueThe place field. Values: PlaceOnTop, PlaceOnBottom. Circulate event.
%s-state value

The state field. A decimal string for events: ButtonPress, ButtonRelease, Enter, Leave, KeyPress, KeyRelease, and Motion.

Values for the Visibility event: VisibilityUnobscured, VisibilityPartiallyObscured, or VisibilityFullyObscured.

%t-time numThe time field. All events.
%v The value_mask field. Configure event.
%w-width numThe width field. Events: Configure and Expose.
%x-x pixelThe X coordinate, widget relative. Mouse events.
%y-y pixelThe Y coordinate, widget relative. Mouse events.
%A 

The printing character from the event, or

{}
.

Events: KeyPress and KeyRelease.

%B-borderwidth numThe border width. Configure event.
%D-delta valueThe delta value. MouseWheel event.
%E-sendevent boolThe send_event field. All events.
%K-keysym symbolThe keysym from the event. Events: KeyPress and KeyRelease.
%N The keysym as a decimal number. Events: KeyPress and KeyRelease.
%R-root winThe root window ID. All events.
%S-subwindow winThe subwindow ID. All events.
%T The type field. All events.
%W The Tk pathname of the widget receiving the event. All events.
%X-rootx pixelThe x_root field. Relative to the (virtual) root window. Events: ButtonPress, ButtonRelease, KeyPress, KeyRelease, and Motion.
%Y-rooty pixelThe y_root field. Relative to the (virtual) root window. Events: ButtonPress, ButtonRelease, KeyPress, KeyRelease, and Motion.


      Previous section   Next section
    Top