diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-DD15F24B-0786-4531-A6C5-A5E70EBE2732.dita --- a/Symbian3/PDK/Source/GUID-DD15F24B-0786-4531-A6C5-A5E70EBE2732.dita Tue Mar 30 11:42:04 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-DD15F24B-0786-4531-A6C5-A5E70EBE2732.dita Tue Mar 30 11:56:28 2010 +0100 @@ -1,63 +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.

-

For a reference design of a layout-aware application using a custom -UI, refer to the S60 Platform: Scalable Screen-Drawing Example available -for download from Forum Nokia.

+ + + + + +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:

+
    +
  • Controls can override the CCoeControl::HandleResourceChange() to +detect the KEikDynamicLayoutVariantSwitch message.

    +
  • +
  • UI controllers can override the CCoeControl::HandleResourceChange() to +detect the KEikDynamicLayoutVariantSwitch message.

    +
  • +
+

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