Handling Events

Gadget holders are responsible for dispatching events to the gadgets. The IlvGadget class has a handleEvent member function that processes user events, such as clicking the mouse or using the keyboard. Unlike with other graphic objects, you do not have to set an interactor to a gadget to be able to use it.

Note

However, you can set an interactor to a gadget if you want to.

The handleEvent member function is virtual and can be redefined in subclasses to handle additional events.

Gadget Holder Events

When the mouse enters or leaves an IlvGadget object, its associated gadget holder generates the IlvMouseEnter and IlvMouseLeave events (These two events are defined in the enum ). These events are sent to the gadget, or to its associated interactor, if any, and are processed by the handleEvent member function. Then, the virtual member functions enterGadget or leaveGadget are called. By default, these member functions invoke the Enter Gadget and the Leave Gadget callbacks, respectively. See Associating a Callback with a Gadget.

One consequence of this is that you cannot have the IlvMouseEnter and IlvMouseLeave event trigger an accelerator because an accelerator is attached to an IlvView object. The IlvView object does not have knowledge of these events.

Note

This only applies to the IlvGadgetContainer and IlvGadgetManager classes.