The UI controller is the default handler for key events. In order for other controls to receive events, you must register them with the control stack with CCoeAppUi::AddToStackL() . Controls are usually added to the control stack in the second phase constructor.
The options are as follows:
In a traditional Symbian UI application architecture , this is done in the UI controller construction phase. An example of an implementation is as follows:
void CAddressBookAppUi::ConstructL() { BaseConstructL(); iCurrentView = CMyAppMainView::NewL( ClientRect() ); AddToStackL( iCurrentView ); }
This places iCurrentView on top of the control stack, which means the UI controller is underneath it in the stack. When the application framework passes an event to the application, the framework first requests that iCurrentView handle it. If this control does not consume the event, then the framework calls the method for the UI controller to handle the event.
CCoeAppUi::AddToStackL() offers a parameter to set the stack priority of a UI control.
You should use CCoeAppUi::RemoveFromStackL() to remove a control from the control stack when it should no longer receive events.
In an Symbian view architecture , this is typically done with CAknView::DoActivateL() when the UI controls are constructed. An example of an implementation for this approach is as follows:
void CMyView::DoActivateL(const TVwsViewId&, TUid , const TDesC8&) { if (!iUIControl) { iUIControl = CMyUiControl::NewL( this, ClientRect() ); AppUi()->AddToStackL( *this, iUiControl ); } }
This places iUiControl on top of the control stack, which means the UI controller is underneath it in the stack. When the application framework passes an event to the application, the framework first requests that iUIControl handle it. If this control does not consume the event, then the framework calls the method for the UI controller to handle the event.
CCoeAppUi::AddToStackL() offers a parameter to set the stack priority for a UI control.
You should use CCoeAppUi::RemoveFromStackL() to remove a control from the control stack when it should no longer receive events.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.