Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



How to handle general events

When a window server event is received, the active scheduler will call the RunL() function to handle the event. Use RWsSession::GetEvent() to get the event, a TWsEvent. An event object always has an event type, a TEventCode, accessed through TWsEvent::Type(), and other data that is useful in handling specific types of event.

The following example uses a switch statement to execute some function when the associated event type is received.

/* Called by active scheduler when an event occurs
Processes events according to their type */
void CExampleWsClient::RunL()
         {
         // Get the event from the window server session iWs
         iWs.GetEvent(iWsEvent);
         // Get the event type: types are defined in TEventCode
         TInt eventType=iWsEvent.Type();/ Process event
         switch (eventType)
         {
         /* Window-group related event types */

         ...

         }