Substitutions

The lambda-expression argument to bind is either a thunk, e. g. (lambda () (print ‘success)), or it is a list with a lambda expression with n arguments, followed by n place-holders for event fields, e. g. in this source fragment:

`(,(lambda (w) (print w)) %W)

In this example, the place-holder %W produces the Tcl-path of the involved window (you can gain the corresponding widget procedure by (tk-id->widget id)).

Unless otherwise indicated, the replacement string is the decimal value of the given field from the current event.

Some of the substitutions are only valid for certain types of events; if they are used for other types of events the value substituted is undefined.

%%
Replaced with a single percent.
%#
The number of the last client request processed by the server (the serial field from the event). Valid for all event types.
%a
The above field from the event, formatted as a hexadecimal number. Valid only for Configure events.
%b
The number of the button that was pressed or released. Valid only for ButtonPress and ButtonRelease events.
%c
The count field from the event. Valid only for Expose events.
%d
The detail field from the event. The %d is replaced by a string identifying the detail. For Enter, Leave, FocusIn, and FocusOut events, the string will be one of the following:
  • NotifyAncestor
  • NotifyNonlinearVirtual
  • NotifyDetailNone
  • NotifyPointer
  • NotifyInferior
  • NotifyPointerRoot
  • NotifyNonlinear
  • NotifyVirtual

For ConfigureRequest events, the string will be one of:

  • Above
  • Opposite
  • Below
  • None
  • BottomIf
  • TopIf

For events other than these, the substituted string is undefined.

%f
The focus field from the event (0 or 1). Valid only for Enter and Leave events.
%h
The height field from the event. Valid for the Configure, ConfigureRequest, Create, ResizeRequest, and Expose events.
%i
The window field from the event, represented as a hexadecimal integer.
%k
The keycode field from the event. Valid only for KeyPress and KeyRelease events.
%m
The mode field from the event. The substituted string is one of NotifyNormal, NotifyGrab, NotifyUngrab, or NotifyWhileGrabbed. Valid only for Enter, FocusIn, FocusOut, and Leave events.
%o
The override_redirect field from the event. Valid only for Map, Reparent, and Configure events.
%p
The place field from the event, substituted as one of the strings PlaceOnTop or PlaceOnBottom. Valid only for Circulate and CirculateRequest events.
%s
The state field from the event. For ButtonPress, ButtonRelease, Enter, KeyPress, KeyRelease, Leave, and Motion events, a decimal string is substituted. For Visibility, one of the strings VisibilityUnobscured, VisibilityPartiallyObscured, and VisibilityFullyObscured is substituted.
%t
The time field from the event. Valid only for events that contain a time field.
%w
The width field from the event. Valid only for Configure, ConfigureRequest, Create, ResizeRequest, and Expose events.
%x
The x field from the event. Valid only for events containing an x field.
%y
The y field from the event. Valid only for events containing a y field.
%A
Substitutes the UNICODE character corresponding to the event, or the empty string if the event doesn't correspond to a UNICODE character (e.g. the shift key was pressed). XmbLookupString (or XLookupString when input method support is turned off) does all the work of translating from the event to a UNICODE character. Valid only for KeyPress and KeyRelease events.
%B
The border_width field from the event. Valid only for Configure, ConfigureRequest, and Create events.
%D
This reports the delta value of a MouseWheel event. The delta value represents the rotation units the mouse wheel has been moved. On Windows 95 & 98 systems the smallest value for the delta is 120. Future systems may support higher resolution values for the delta. The sign of the value represents the direction the mouse wheel was scrolled.
%E
The send_event field from the event. Valid for all event types.
%K
The keysym corresponding to the event, substituted as a textual string. Valid only for KeyPress and KeyRelease events.
%N
The keysym corresponding to the event, substituted as a decimal number. Valid only for KeyPress and KeyRelease events.
%R
The root window identifier from the event. Valid only for events containing a root field.
%S
The subwindow window identifier from the event, formatted as a hexadecimal number. Valid only for events containing a subwindow field.
%T
The type field from the event. Valid for all event types.
%W
The path name of the window to which the event was reported (the window field from the event). Valid for all event types.
%X
The x_root field from the event. If a virtual-root window manager is being used then the substituted value is the corresponding x-coordinate in the virtual root. Valid only for ButtonPress, ButtonRelease, KeyPress, KeyRelease, and Motion events.
%Y
The y_root field from the event. If a virtual-root window manager is being used then the substituted value is the corresponding y-coordinate in the virtual root. Valid only for ButtonPress, ButtonRelease, KeyPress, KeyRelease, and Motion events.

© Author | Home | Sitemap