When a Window Server event is received, the active scheduler calls 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. 
Variant: ScreenPlay and non-ScreenPlay. Target audience: Application developers.
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 */
    ...
    }