Namespaces

Variants
Actions

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 over the next few weeks. Thanks for all your past and future contributions.

Archived:Switching orientation in dialog-based Symbian C++ applications

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}}.

Article Metadata
Tested with
Devices(s): All (S60 3rd Edition)
Compatibility
Platform(s): S60 3rd Edition
S60 3rd Edition, Feature Pack 1
S60 3rd Edition, Feature Pack 2
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Article
Keywords: KEikDynamicLayoutVariantSwitch
Created: User:Technical writer 1 (26 Nov 2008)
Last edited: hamishwillee (14 Jun 2012)

Description

Support for changing the application orientation between portrait and landscape modes can be added by implementing the HandleResourceChangeL() function in the App UI class and reacting to events of type KEikDynamicLayoutVariantSwitch.

Switching between display modes can cause visible UI problems in dialog-based applications (applications using a CEikDialog or CAknDialog-derived class as their main UI) if the dialog is not made aware of the change.

Solution

When receiving this type of event in a dialog-based application or when any custom dialog is being displayed, that event should also be forwarded to the active dialog to ensure that it has the correct layout also after the orientation switch:

  void CMyDialogBasedAppUi::HandleResourceChangeL( TInt aType )
{
// First call base class implementation
CAknAppUi::HandleResourceChangeL( aType );
 
if ( aType == KEikDynamicLayoutVariantSwitch )
{
if ( iDialog )
{
TRect rect;
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
iDialog->SetRect( rect );
'''iDialog->HandleResourceChange( aType );'''
}
}
}
This page was last modified on 14 June 2012, at 07:54.
37 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×