8.5 Input Control

The canvas models the input in two handlers: the event handler and the interaction handler. The canvas uses the event handler to receive general events such as window resizing and updates. Each canvas has exactly one event handler. The interaction handler is started by request, e.g., when a new graphical objects is to be created. The interaction handler is a special-purpose event handler, designed for fast interaction with the user.

The typical situation is that the event handler polls for input from the user, and when the user e.g. starts creating a new ellipse by clicking on a mouse button, the application calls InteractiveCreate for an ellipse graphical object. Interactive create is implemented using an interactionhandler.

The event handler is described in this section and the interaction handler is described in Interaction.

The event handler models the events originating from the basic graphics system or from user actions by six virtual operations. The application programmer may then further bind these operations in an application that uses the Bifrost graphics system.

OnOpen.
Called when the canvas is shown for the first time on the display device.
OnButtonDown.
Called when the user presses a button on the pointing device.
OnKeyDown.
Called when the user hits a key on the keyboard.
OnRefresh.
Called when the canvas must be redrawn, e.g. when it is exposed after is has been obscured. The refresh event is typically generated by the basic graphics system (or by the window manager).
OnActivate and OnDeactivate.
Called when the canvas is (de)activated. The exact definition of activation may vary with the device. In a window system, the active window will normally have its title bar highlighted. The activation occurs when the window becomes the active window.


The Bifrost Graphics System - Reference Manual
© 1991-2004 Mjølner Informatics
[Modified: Monday October 16th 2000 at 13:43]