[ Team LiB ] Previous Section Next Section

Event Summary

Event Command Syntax

The event command is summarized in Table 29-3.

Table 29-3. The event command

event add virt phys1 phy2 ...

Adds a mapping from one or more physical events to virtual event virt.

event delete virt

Deletes virtual event virt.

event info

Returns the defined virtual events.

event info virt

Returns the physical events that map to virt.

event generate win event ?opt val? ...

Generates event for window win. The options are listed in Table 29-4.

Event Keywords

Table 29-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 29-4. A summary of the event keywords

%%

 

Use this to get a single percent sign. All events.

%#

-serial num

The serial number for the event. All events.

%a

-above win

The above field from the event. Configure event.

%b

-button num

Button number. Events: ButtonPress and ButtonRelease.

%c

-count num

The count field. Events: Expose and Map.

%d

-detail value

The detail field. Values: NotifyAncestor, NotifyNonlinearVirtual, NotifyDetailNone, NotifyPointer, NotifyInferior, NotifyPointerRoot, NotifyNonlinear, or NotifyVirtual.

Events: Enter, Leave, FocusIn, and FocusOut.

%f

-focus boolean

The focus field (0 or 1). Events: Enter and Leave.

%h

-height num

The height field. Events: Configure and Expose.

%i

 

The window field from the event, represented as a hexadecimal integer. All events.

%k

-keycode num

The keycode field. Events: KeyPress and KeyRelease.

%m

-mode value

The mode field. Values: NotifyNormal, NotifyGrab, NotifyUngrab, or NotifyWhileGrabbed. Events: Enter, Leave, FocusIn, and FocusOut.

%o

-override boolean

The override_redirect field. Events: Map, Reparent, and Configure.

%p

-place value

The 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 num

The time field. All events.

%v

 

The value_mask field. Configure event.

%w

-width num

The width field. Events: Configure and Expose.

%x

-x pixel

The X coordinate, widget relative. Mouse events.

%y

-y pixel

The Y coordinate, widget relative. Mouse events.

%A

 

The printing character from the event, or {}.

Events: KeyPress and KeyRelease.

%B

-borderwidth num

The border width. Configure event.

%D

-delta value

The delta value. MouseWheel event.

%E

-sendevent bool

The send_event field. All events.

%K

-keysym symbol

The keysym from the event. Events: KeyPress and KeyRelease.

%N

 

The keysym as a decimal number. Events: KeyPress and KeyRelease.

%P

 

The atom name for the property being changed or deleted. Property event.

%R

-root win

The root window ID. All events.

%S

-subwindow win

The subwindow ID. All events.

%T

 

The type field. All events.

%W

 

The Tk pathname of the widget receiving the event. All events.

%X

-rootx pixel

The x_root field. Relative to the (virtual) root window. Events: ButtonPress, ButtonRelease, KeyPress, KeyRelease, and Motion.

%Y

-rooty pixel

The y_root field. Relative to the (virtual) root window. Events: ButtonPress, ButtonRelease, KeyPress, KeyRelease, and Motion.

    [ Team LiB ] Previous Section Next Section