BINDING CALLBACKS AND SUBSTITUTIONS The *callback* argument to bind is a perl/Tk callback. which will be executed whenever the given event sequence occurs. (See Tk::callbacks for description of the possible forms.) *Callback* will be associated with the same MainWindow that is associated with the *$widget* that was used to invoke the bind method, and it will run as though called from MainLoop. If *callback* contains any Ev(*%*) calls, then each "nested" Ev(*%*) "callback" will be evaluated when the event occurs to form arguments to be passed to the main *callback*. The replacement depends on the character *%*, as defined in the list below. Unless otherwise indicated, the replacement string is the numeric (decimal) value of the given field from the current event. Perl/Tk has enhanced this mechanism slightly compared to the comparable Tcl/Tk mechanism. The enhancements are not yet all reflected in the list below. 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 (not the same as undef!). '#' 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. (Note that this is *not* the same as Detail part of sequence use to specify the event.) '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 only for Configure, ConfigureRequest, Create, Expose, and ResizeRequest 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, ConfigueRequest, Create, Expose, and ResizeREquest 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. '@' The string "@*x,y*" where *x* and *y* are as above. Valid only for events containing *x* and *y* fields. This format is used my methods of Tk::Text and similar widgets. '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 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, as an object if it is one otherwise 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 window to which the event was reported (the $widget field from the event) - as an perl/Tk object. 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.