Symbian3/PDK/Source/GUID-FC63E2D1-697C-4890-9B70-0DC0AAE7597C.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Tue, 30 Mar 2010 11:56:28 +0100
changeset 5 f345bda72bc4
parent 3 46218c8b8afa
child 14 578be2adaf3e
permissions -rw-r--r--
Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-FC63E2D1-697C-4890-9B70-0DC0AAE7597C" xml:lang="en"><title>Switching
views in traditional architecture</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>If the application contains multiple views and they need to be switched,
it can be done in various ways. One of the common ways is to delete the current
view, create a new view, and add the new one to the control stack. Here, <parmname>CMyAppUi</parmname> has
a custom method to change a view. Often a more generic approach should be
favored, but for simplicity the basic idea could be as follows:</p>
<codeblock id="GUID-CEEB1B52-944E-4C2D-A9A9-AB1D55559234" xml:space="preserve">void CMyAppUi::ChangeToView2L()
    {
    CCoeControl* newView = CMyAppView2::NewL(ClientRect());
    if(iCurrentView)
        {
        RemoveFromStack(iCurrentView);
        delete iCurrentView;
        }
    iCurrentView = newView;
    AddToStackL(iCurrentView);
    }
</codeblock>
<p>Although this architecture provides the most flexible way of manipulating
different views, the <xref href="GUID-68B999C2-0993-4804-9624-42C3D88BE5C7.dita">view
architecture</xref> should be considered. Among other things, it provides
a ready framework for doing the essentials in view switching.</p>
</conbody></concept>