Next: Translation tables Up: Events and Callbacks Previous: Events and Callbacks

Principles of Event Handling

When a widget is created it will know how to respond to certain internal events such as a window manager request to change size or colour and how to change appearance when pressed.

However, in order to be useful to the programmer a widget must be attached to application functions.

Widgets have special resources called callback resources to take care of this.

An event is defined to be any mouse or keyboard (or any input device) action. The effect of an event is numerous ranging from window resizes and moves to invoking of functions available from the GUI.

X handles events asynchronously - events can occur in any order.

X can basically take a continuous stream of events and then dispatch them accordingly to the appropriate applications (remember X can run more than one program at a time) which then take appropriate actions.

If you write programs in Xlib then there are many low level functions for handling events.

Xt however simplifies the event handling task since widgets are capable of handling many events for us

e.g. widgets know how to redraw themselves and respond to mouse presses.

How widgets respond to certain mouse actions is predefined as part of the widget's resources.


Dave.Marshall@cm.cf.ac.uk
Tue May 24 16:52:56 BST 1994