|
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="GUID-26F8606A-0803-3693-A022-3BB620D64C0E.dita#GUID-26F8606A-0803-3693-A022-3BB620D64C0E/GUID-BA4DF836-625E-3AE6-8538-8B1C5A36900B"><apiname>CAknViewAppUI::ActivateLocalViewL()</apiname></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="GUID-3AC2CDAC-0291-309F-A020-049BC9F2CF90.dita#GUID-3AC2CDAC-0291-309F-A020-049BC9F2CF90/GUID-013EC4FB-9B9D-352A-B3F5-9C37B4458032"><apiname>CCoeAppUi::ActivateViewL()</apiname></xref> function, |
|
43 giving <xref href="GUID-3DEA9A17-CB50-3DCD-87AC-0E91B377FB0E.dita"><apiname>TVwsViewId</apiname></xref> containing the target application’s UID |
|
44 and the target view UID. </p> |
|
45 <p>Optionally, if the remote application view requires, give a message |
|
46 ID and the descriptor data, which the view needs for its initialization. The |
|
47 remote application view documentation publishes the required parameters.</p> |
|
48 <p>Note that the calling and target application are independent of each |
|
49 other. When the target application exits, it will not exit the calling application. |
|
50 Also, when the calling client exits after switching the remote view of the |
|
51 target application, it will not exit the target application.</p> |
|
52 <p>Remote view switching is a one-way request through the application framework |
|
53 from a calling application to a target application. The caller can send data, |
|
54 but the target application cannot pass data back through the framework. Of |
|
55 course, the calling application may pass a file path, which could be used |
|
56 for data exchange.</p> |
|
57 </section> |
|
58 </conbody></concept> |