When an event occurs under the window server, the framework calls the CCoeAppUi::HandleWsEventL() function of the UI controller object. To implement an event-handling code for a certain event, CCoeAppUi::HandleWsEventL() must be overridden. To ensure that the system works correctly, after catching an event in the overridden CCoeAppUi::HandleWsEventL() function the base class implementation should be called. The event type is identified by TEventCode, which is a data member of the window server event, TWsEvent.
void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination )
All the event types are defined in the w32std.h.
Some event types are not implemented in the system or are not available for third-party applications. All event codes from TEventCode::EEventUser() upwards can be used for the application-specific events (discussed in Application-specific events).
The following is a code example of the usage of a window server event:
void CMyAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ) { // Call the base class implementation CEikAppUi::HandleWsEventL( aEvent, aDestination ); if( aEvent.Type() == EEventKeyDown ) { // Do something iEikonEnv->InfoMsg( _L( “Key was pressed” ) ); } }