monitor messages
GuiDesigner processes GraphicsDesigner messages without the knowledge or assistance of your programs by sending them to the window function responsible for the window or grid in the message. Window functions process window messages and send grid messages to the appropriate grid functions.

This directs each message to the function designed to handle it, and nowhere else. Some programs, however, need to watch for certain events, no matter where or when they occur.

For example, many programs let the keyboard "function keys" perform specific actions, regardless of which window is selected. When processed by XgrProcessMessages() , however, keyboard messages for function keys are sent to the same place as any keyboard message - to the window function of the selected window.

To watch for special messages, GraphicsDesigner lets programs register one CEO function.

CEO function
The CEO function receives every message processed by XgrProcessMessages() .

XgrProcessMessages() sends every message to the CEO function first, before it sends it anywhere else. The CEO can cancel the message to prevent its propogation to other functions.

Programs call XgrSetCEO(&Func()), to make a CEO function, active, where &Func() is the address of the CEO function. XgrSetCEO(0) cancels CEO processing.

When messages are processed by XgrProcessMessages() they are first sent to the CEO function, then to the appropriate window function. The window function may issue MonitorContext , MonitorKeyboard , MonitorMouse messages.

XgrProcessMessages() calls the CEO function, passing the message arguments, 0 in r0, and a copy of window or grid argument in r1 . The CEO can examine the message and take whatever action it needs to perform its function. If the CEO returns -1 in r0, XgrProcessMessages() cancels the message and returns without calling the window function it would otherwise.