Chapter 11. Creating an Event and Device

Table of Contents

This chapter describes how to create a new event and a new Xt device. The examples show how to subclass events and Xt devices and how to translate X events into Inventor events.

This chapter focuses on translating X events into Inventor events. This general process can be applied to the translation of any window-specific events into Inventor events, which are independent of the window system. Examples 11-1 and 11-2 show how to create the DialEvent, which is used by the dial and button device.

The details of setting up an SoXt device to work with a render area are also explained here. Note that new devices can be added only if you are using the Inventor Component Library. Examples 11-4 and 11-5 use the DialNButton device to show how to translate events and communicate with the render area.

Note that new events will not automatically be understood by existing manipulators. You can create new manipulators (or other objects that respond to events) to recognize the new events. Or you can register a new static method for an existing manipulator in the method list for the SoHandleEventAction SoHandleEventAction SoHandleEventAction . Then your new method for the manipulator can handle the new events appropriately (see Chapter 4).

Before reading this chapter, be sure to read Chapters 10 and 16 in The Inventor Mentor.