Symbian3/SDK/Source/GUID-FC63E2D1-697C-4890-9B70-0DC0AAE7597C.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

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