diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-DD15F24B-0786-4531-A6C5-A5E70EBE2732.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-DD15F24B-0786-4531-A6C5-A5E70EBE2732.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,62 @@ + + + + + +Layout +change events +

Layout change events are generated when the screen size or layout is +changed. The Symbian platform supports multiple screen resolutions (scalable UI). Thus, +layout awareness is particularly crucial for those applications that implement +a customized UI instead of using automatically scalable AVKON UI components. +Applications can detect the changes in layout with, for example, the following +methods:

+ +

The following example code demonstrates the implementation of HandleResourceChange():

+void CExampleControl::HandleResourceChange( TInt aType ) + { + CCoeControl::HandleResourceChange(aType); + //call base class implementation + if( aType==KEikDynamicLayoutVariantSwitch ) + { + TRect rect; + // ask where container's rectangle should be + // EMainPane equals to area returned by + //CEikAppUi::ClientRect() + AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,rect ); + SetRect( rect ); + } + } + +

The following example code demonstrates the implementation of HandleResourceChangeL():

+void CExampleAppUi::HandleResourceChangeL( TInt aType ) + { + CAknAppUi::HandleResourceChangeL( aType ); + if( aType == KEikDynamicLayoutVariantSwitch ) + { + // do the re-layout of the components + } + // Controls derived from CCoeControl, handled in a + // container class + iExampleControlContainer->HandleResourceChange( aType ); + //Must not call this if the components are on the control stack + //iView->HandleResourceChangeL( aType ); + } + +

If iExampleControlContainer is added to the control +stack, it will get its HandleResourceChange() called +when a layout is switched and there is no need to call it explicitly.

+
\ No newline at end of file