Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Handling scalability in Symbian C++ on touch enabled device

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition
Keywords: CAknAppUi::HandleResourceChangeL(), CCoeControl::HandleResourceChange()
Created: tepaa (03 Oct 2008)
Last edited: lpvalente (23 Sep 2014)



S60 5th Edition supports touch events. All AVKON UI controls handle touch UI events and you do not need to implement anything new.

If you implement your own custom CCoeControl UI control, it is important to handle its scalability. If scalability is not handled, the S60 platform may not receive touch events, or it may receive touch events for the incorrect control because the correct location of the touch event may not be known.

MMP file

The following libraries are required:

LIBRARY cone.lib

Handle resoucre change

Custom CCoeControl-derived classes must be able to react to changes in UI layout.

void CMyControl::HandleResourceChange(TInt aType)
// Call base class implementation
if ( aType==KEikDynamicLayoutVariantSwitch )
// Setting new rect for this control
TRect rect;
// SetRect() causes calling components SizeChanged()

Handle scalability in your application CAknAppUi class:

void CMyAppUi::HandleResourceChangeL(TInt aType)
// Call base class implementation
CAknAppUi::HandleResourceChangeL( aType );
if ( aType == KEikDynamicLayoutVariantSwitch )
// Do the re-layout of the components
// TODO: do some layout impl here if needed
// NOTE: Must not call this if the components are on the control stack
// iMyView->HandleResourceChangeL( aType );
// NOTE: If CMyControl is in control stack is
// CMyControl::HandleResourceChange() called automatically

Adding controls into control stack

If a control is in the control stack, it will receive key events and resource change events.

In traditional Symbian C++ applications, when CMyAppUi is derived from CAknAppUi:

void CMyAppUi::ConstructL ( )
// Initialise app UI with standard value.
BaseConstructL (EAknEnableSkin | EAknTouchCompatible);
// Create view
iAppView = CMobilePaintAppView::NewL (ClientRect ( ) );
// --> Add view into control stack
AddToStackL( iAppView );

When using view switching CMyAppUi is derived from CAknViewAppUi. The control is added into the control stack when the view is activated.

void CMyView::DoActivateL(const TVwsViewId& aPrevViewId,
TUid aCustomMessageId, const TDesC8& aCustomMessage)
if (!iContainer)
iContainer = CMyControl::NewL(ClientRect());
// --> Add view into control stack
AppUi()->AddToStackL (*this, iContainer);


Scalability of the control is handled.

See also

S60 Platform: Image Converter Example

This page was last modified on 23 September 2014, at 19:57.
54 page views in the last 30 days.