Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to get user events

The UI Control Framework receives events from the window server, and channels them to controls for processing. Events are either redraw events, user input events (pointer events and key events), or special events generated by the window server in response to things happening in the system, such as the machine being switched on.


Redraw events

These are generated by the window server whenever a window or part of a window becomes invalid. The control framework handles redraw events internally. It activates the graphics context for drawing, and calls the control's Draw() function. See Window server initiated drawing for details.

[Top]


Pointer events

To handle pointer events, a control should implement the function HandlePointerEventL(). This function is called by the UI Control Framework whenever a pointer event occurs within the control.

Before passing pointer events to HandlePointerEventL(), the framework does some processing of the event. If a TPointerEvent::EButton1Down event occurred in the control, and the control does not currently have keyboard focus, it sends an event of type MCoeControlObserver::EEventRequestFocus to the control's observer — normally the control's container. The container control should then set focus onto the control in which the TPointerEvent::EButton1Down event occurred.

Note that, by default, pointer drag events and pointer move events are not delivered to controls. See EnableDragEvents().

[Top]


Key events

Key events are delivered to controls by the control stack which calls the control's OfferKeyEventL() function. Controls that need to handle key events should therefore implement this function.

If a control does not take any action in response to the key event, it must return EKeyWasNotConsumed from OfferKeyEventL(). Otherwise, it will prevent other controls from receiving the event.

[Top]


Other event types

Other event types besides pointer events and key events are sometimes used for specialist applications, but they must be accessed via the window server.

[Top]


Sending events to other controls — control observers

In addition to handling events directly, controls may also send events to other controls, using the control observer class, MCoeControlObserver. These events are not user input events, but a different set of event types defined by MCoeControlObserver.