Symbian3/SDK/Source/GUID-FC63E2D1-697C-4890-9B70-0DC0AAE7597C.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?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>