Name

event

event operation [arg arg...]

The event command provides several facilities for dealing with window system events, such as defining virtual events and synthesizing events. The following operations are defined:

event add <<virtual>> sequence [sequence...]

Add the given event sequences to those associated with the virtual event virtual. The virtual event will trigger whenever any one of the given sequences occurs. See the bind command for allowed sequence values.

event delete <<virtual>> [sequence [sequence...] ]

Delete the given event sequences from those associated with the virtual event virtual. If no sequence is given, all sequences associated with the virtual event are removed.

event generate window sequence [option value...]

Generate an event for window window and arrange for it to be processed just as if it had come from the window system. Window may be a window pathname or an identifier (as returned by winfo id), as long as it is in the current application. The sequence argument describes the event to generate. It may have any of the forms allowed for the sequence argument to the bind command, except that it must consist of a single event pattern (e.g., <Shift-Button-2> or <<Paste>>).

The event generated can be further described with the optional optionvalue pairs. In the descriptions of these options that follow, the [%char] at the beginning identifies the corresponding bind command substitution. The available options are as follows:

-above window

[%a] The above field for the event, either as a window or integer window ID.

-borderwidth size

[%B] The border_width field for the event as a screen distance.

-button number

[%b] The detail field for a ButtonPress or ButtonRelease event.

-count integer

[%c] The count field for the event.

-detail detail

[%d] The detail field for the event.

-focus boolean

[%f] The focus field for the event.

-height size

[%h] The height field for the event as a screen distance.

-keycode integer

[%k] The keycode field for the event.

-keysym name

[%K] The keysym field for the event.

-mode notify

[%m] The mode field for the event.

-override boolean

[%o] The override_redirect field for the event.

-place where

[%p] The place field for the event.

-root window

[%R] The root field for the event as a window pathname or integer window ID.

-rootx coord

[%X] The x_root field for the event as a screen distance.

-rooty coord

[%Y] The y_root field for the event as a screen distance.

-sendevent boolean

[%E] The send_event field for the event.

-serial integer

[%#] The serial field for the event.

-state state

[%s] The state field for the event.

-subwindow window

[%S] The subwindow field for the event as a window pathname or an integer window ID.

-time integer

[%t] The time field for the event.

-width size

[%w] The width field for the event as a screen distance.

-when when

Determines when the event will be processed. When must have one of the following values:

now

Process the event immediately before the event command returns. This is the default.

tail

Place the event at the end of Tcl’s event queue.

head

Place the event at the front of Tcl’s event queue.

mark

Place the event at the front of Tcl’s event queue but behind any other events already queued with -when mark.

-x coord

[%x] The x field for the event as a screen distance.

-y coord

[%y] The y field for the event as a screen distance.

event info [<<virtual>>]

If the <<virtual>> argument is omitted, a list of all currently defined virtual events is returned. Otherwise, the return value is the list of event sequences currently associated with virtual event virtual.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset