5.3.5. Windowing System Events

Gamma's GUI support offers PtAttachCallback for Photon and AttachCallback for X Windows that permit attaching callbacks to any GUI event. Like the other event handling functions, the user can in fact bind any Gamma expression for execution when the event occurs.

5.3.5.1. GUI Event Handlers (Callbacks)

A GUI event handler, also known as a callback, is an arbitrary expression attached to a particular callback of a widget. A callback may occur whenever a call is made to next_event, next_event_nb, and flush_events. If the appropriate GUI event has occurred, then the Gamma engine automatically evaluates any callback handlers that deal with the event attached to the particular widget. This results in essentially asynchronous program flow, where the callback may occur, from the user's perspective, at any time during the program execution. In reality, the GUI event is only handled if the system has been instructed to deal with one or more incoming events.