|
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-3B441CDC-AB7A-4D8D-A595-57C21E1D426C" xml:lang="en"><title>Foreground |
|
13 events</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>The application framework calls <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeAppUiClass.html#%3a%3aCCoeAppUi%3a%3aHandleForegroundEventL%28TBool%29" format="application/java-archive"><parmname>CCoeAppUI::HandleForegroundEventL()</parmname></xref> when the application |
|
15 is switched to the foreground or background.</p> |
|
16 <p>While the default implementation of this method is empty, it can be, |
|
17 for example, used to display messages or pause a game when a focus change |
|
18 event occurs.</p> |
|
19 <p>An example of such a foreground event implementation is as follows:</p> |
|
20 <codeblock id="GUID-ECF10193-AB06-4267-A47F-D5EC2C561D9C" xml:space="preserve">// ------------------------------------------------------------------------------ |
|
21 // CMyViewAppUi::HandleForegroundEventL(TBool aForeground) |
|
22 // This function is called by the framework when the screen loses or gains focus. |
|
23 // i.e. when it goes to the background or to the foreground. Incoming call |
|
24 // softnote is an example. |
|
25 // This event applies to the entire application, all views. |
|
26 // ------------------------------------------------------------------------------ |
|
27 // |
|
28 void CMyViewAppUi::HandleForegroundEventL(TBool aForeground) |
|
29 { |
|
30 if( aForeground == TRUE ) |
|
31 { |
|
32 iEikonEnv->InfoMsg( _L( "Foreground true" ) ); |
|
33 } |
|
34 else |
|
35 { |
|
36 iEikonEnv->InfoMsg( _L( "Foreground false" ) ); |
|
37 } |
|
38 } |
|
39 </codeblock> |
|
40 <p>The <parmname>aForeground</parmname> parameter is true if the application |
|
41 is switched to the foreground (is visible) and false if the application has |
|
42 gone to the background</p> |
|
43 <note> |
|
44 <p>The above code snippet uses the <i>MyView</i> example application provided |
|
45 in the <i>S60 Platform: Platform Application Views</i> package available from <xref href="http://www.forum.nokia.com/info/sw.nokia.com/id/9c5f21fd-2162-42da-aaf6-17a59b943475/S60_Platform_Application_Views_v2_0_en.zip.html" scope="external">Forum |
|
46 Nokia</xref> . </p> |
|
47 </note> |
|
48 </conbody></concept> |