|
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 task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-2D6689C2-F17D-48A8-8EC9-3D83BCAA3681" xml:lang="en"><title>Activate |
|
13 a view</title><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
14 <context> <p>Activation is the process of switching or linking to a |
|
15 view. When the new view is activated, the old view is deactivated, and the |
|
16 new view is marked as the current view. Applications can have only a single |
|
17 view active at any given point of time. The current active view is the view |
|
18 that interacts with the user and receives events and menu choices.</p> |
|
19 <p>Activation of a view is done using any of the following methods: </p><ul> |
|
20 <li><p>View activation without custom message. </p><codeblock xml:space="preserve">CCoeAppUi::ActivateViewL( TVwsViewId& aViewId ) |
|
21 </codeblock></li> |
|
22 <li><p>View activation with custom message.</p><codeblock xml:space="preserve">CCoeAppUi::ActivateViewL( TVwsViewId& aViewId TUid aCustomMessageId, |
|
23 TDesC8& CustomMessage )</codeblock></li> |
|
24 </ul><note> Deactivation of view is necessary before exiting from the application, |
|
25 if the application UI has an active view. This can be done using the <codeph>CCoeAppUi::DeactivateActiveViewL( |
|
26 )</codeph> function.</note><p>The following code snippet shows activating |
|
27 a view:</p><codeblock xml:space="preserve">void CNewAppUi::ActivateViewL(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC16& aCustomMessage) |
|
28 { |
|
29 HBufC8* narrowMessage = HBufC8::NewLC( aCustomMessage.Size() ); |
|
30 TPtr8 ptr=narrowMessage->Des(); |
|
31 ptr.Copy( ( TUint8* )aCustomMessage.Ptr(), aCustomMessage.Size() ); |
|
32 CCoeAppUi::ActivateViewL( aViewId,aCustomMessageId,narrowMessage->Des() ); |
|
33 iCCoeAppUi->NotifyNextActivation( *iViewActivationObserver_Notify ); |
|
34 CleanupStack::PopAndDestroy( narrowMessage ); |
|
35 }</codeblock></context> |
|
36 </taskbody></task> |