|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-DFDDF0C5-0E66-4394-A746-7FE35EEA4E6A" xml:lang="en"><title>Switching |
|
13 views in the view architecture</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section id="GUID-5D19303A-8318-4F7B-84CF-FAAE630225FD"><title>Local switching</title> |
|
15 <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> |
|
16 <p>An example implementation of switching between views in an application |
|
17 as a result of <xref href="GUID-4941C035-C359-4968-9BD5-31F44EE5F810.dita">command |
|
18 handling</xref> is as follows:</p> |
|
19 <codeblock id="GUID-4CC3D27C-CB0B-4BF2-AFEB-13CC054D509A" xml:space="preserve">case EMyViewAppCmdView1Cmd1: |
|
20 { |
|
21 // Switch to view 2 |
|
22 AppUi()->ActivateLocalViewL(KView2Id); |
|
23 break;</codeblock> |
|
24 <p>, where <parmname>KView2Id</parmname> is the UID for view 2 in the application, |
|
25 and is defined in another header filer in the application.</p> |
|
26 <p>A new view is activated first and the previous view is deactivated after |
|
27 that. This allows quick view switching to take place. When deactivating, all |
|
28 controls, including menus and dialogs, are also closed down.</p> |
|
29 <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 |
|
30 is to be used, its contents must be updated for the new view prior to switching.</p> |
|
31 <p>An example implementation is as follows:</p> |
|
32 <codeblock id="GUID-508F9B8E-7C24-4E8B-91FA-F0E596B91A29" xml:space="preserve">// Switch to a new menu system for the new view. |
|
33 iEikonEnv->AppUiFactory()->MenuBar()-> |
|
34 SetMenuTitleResourceId(R_MY_VIEW_ARCH_APP_VIEW2_MENU); |
|
35 // Now switch the view to view 2 |
|
36 iAvkonViewAppUi->ActivateLocalViewL(TUid::KView2Id); |
|
37 </codeblock> |
|
38 </section> |
|
39 <section id="GUID-A8098599-D103-4DB6-B7BE-1E01AF10B88A"><title>Remote switching</title> |
|
40 <p>In remote view switching, an application initiates the remote target |
|
41 application to change its view. If the application is not running, it is started.</p> |
|
42 <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 |
|
43 UID. </p> |
|
44 <p>Optionally, if the remote application view requires, give a message |
|
45 ID and the descriptor data, which the view needs for its initialization. The |
|
46 remote application view documentation publishes the required parameters.</p> |
|
47 <p>Note that the calling and target application are independent of each |
|
48 other. When the target application exits, it will not exit the calling application. |
|
49 Also, when the calling client exits after switching the remote view of the |
|
50 target application, it will not exit the target application.</p> |
|
51 <p>Remote view switching is a one-way request through the application framework |
|
52 from a calling application to a target application. The caller can send data, |
|
53 but the target application cannot pass data back through the framework. Of |
|
54 course, the calling application may pass a file path, which could be used |
|
55 for data exchange.</p> |
|
56 </section> |
|
57 </conbody></concept> |