Symbian3/PDK/Source/GUID-DFDDF0C5-0E66-4394-A746-7FE35EEA4E6A.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Fri, 22 Jan 2010 18:26:19 +0000
changeset 1 25a17d01db0c
child 3 46218c8b8afa
permissions -rw-r--r--
Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608

<?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-DFDDF0C5-0E66-4394-A746-7FE35EEA4E6A" xml:lang="en"><title>Switching
views in the view architecture</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-5D19303A-8318-4F7B-84CF-FAAE630225FD"><title>Local switching</title>
<p>To switch between views within an application, you can use <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknViewAppUi.html#65e2d009edf0f2f2678ff88788907683" format="application/java-archive"><parmname>CAknViewAppUI::ActivateLocalViewL()</parmname></xref>.</p>
<p>An example implementation of switching between views in an application
as a result of <xref href="GUID-4941C035-C359-4968-9BD5-31F44EE5F810.dita">command
handling</xref> is as follows:</p>
<codeblock id="GUID-4CC3D27C-CB0B-4BF2-AFEB-13CC054D509A" xml:space="preserve">case EMyViewAppCmdView1Cmd1:
            {
            // Switch to view 2            
            AppUi()-&gt;ActivateLocalViewL(KView2Id);
            break;</codeblock>
<p>, where <parmname>KView2Id</parmname> is the UID for view 2 in the application,
and is defined in another header filer in the application.</p>
<p>A new view is activated first and the previous view is deactivated after
that. This allows quick view switching to take place. When deactivating, all
controls, including menus and dialogs, are also closed down.</p>
<p>Each view may have its own menu system as defined in the <xref href="GUID-B238952B-1691-49F4-B8B9-9F755011A7DD.dita"><parmname>AVKON_VIEW</parmname> resource</xref> structure. However, if the menu system owned by the application
is to be used, its contents must be updated for the new view prior to switching.</p>
<p>An example implementation is as follows:</p>
<codeblock id="GUID-508F9B8E-7C24-4E8B-91FA-F0E596B91A29" xml:space="preserve">// Switch to a new menu system for the new view.
iEikonEnv-&gt;AppUiFactory()-&gt;MenuBar()-&gt;
    SetMenuTitleResourceId(R_MY_VIEW_ARCH_APP_VIEW2_MENU);
// Now switch the view to view 2
iAvkonViewAppUi-&gt;ActivateLocalViewL(TUid::KView2Id);
</codeblock>
</section>
<section id="GUID-A8098599-D103-4DB6-B7BE-1E01AF10B88A"><title>Remote switching</title>
<p>In remote view switching, an application initiates the remote target
application to change its view. If the application is not running, it is started.</p>
<p>In the application, call the <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeAppUiClass.html#%3a%3aCCoeAppUi%3a%3aActivateViewL%28const%20TVwsViewId%20%26amp%3b%29" format="application/java-archive"><parmname>CCoeAppUi::ActivateViewL()</parmname></xref> function, giving <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/View_Server/TVwsViewIdClass.html" format="application/java-archive"><parmname>TVwsViewId</parmname></xref> containing the target application’s UID and the target view
UID. </p>
<p>Optionally, if the remote application view requires, give a message
ID and the descriptor data, which the view needs for its initialization. The
remote application view documentation publishes the required parameters.</p>
<p>Note that the calling and target application are independent of each
other. When the target application exits, it will not exit the calling application.
Also, when the calling client exits after switching the remote view of the
target application, it will not exit the target application.</p>
<p>Remote view switching is a one-way request through the application framework
from a calling application to a target application. The caller can send data,
but the target application cannot pass data back through the framework. Of
course, the calling application may pass a file path, which could be used
for data exchange.</p>
</section>
</conbody></concept>