src/swipl-devel/packages/xpce/man/refmanual/md/event.md

class event {#class-event}

An event is PCE's notion of representing some activity from the user. Such an activity may be the user pressing a key on the keyboard, a button of the mouse, changing the mouse's location, etc.

Events are typed and their types are organised in a hierarchy. See Class event_tree. Note that event-types have no relation to PCE data-types as described by class type.

Events are trapped from the X-window environment by class window. This class deals internally with low-level events such as repaint requests. All events that may be of interest to the user are transformed into PCE event objects, which are then dispatched by a graphical device object.

There are several ways to program event handling. The most common way is to use gesture objects. A gesture object parses one or a sequence of events into meaningful actions such as click, move, resize, connect, etc. Gestures may be attached to graphical objects using graphical ->recogniser. When using user-defined classes, events may be parsed by redefining the graphical ->event method. Gestures are normally used to realise the event-parsing in the redefined method.

Bugs:

The single inheritance hierarchy for event type specification is not very satisfactory. A multiple inheritance hierarchy would be better. A common problem arrising is that you may wish to have all left-button events, regardless of whether it is an up, down or drag or all button-down events, regardless of the exact button.

ASCII events are defined very ungracefully. Be aware that consistency with class editor will probably be implemented some day, changing --for example-- type 3 into \C-c.

@see class gesture @see class recogniser @see class event_tree @see topic Events @see class dialog_item @see class window @see class device @see object->recogniser

Class variables {#class-event-classvars}

Instance variables {#class-event-instvars}

Send methods {#class-event-send}

Get methods {#class-event-get}



Try the rswipl package in your browser

Any scripts or data that you put into this service are public.

rswipl documentation built on June 16, 2026, 5:07 p.m.