|
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-11FE772A-E662-4B88-B871-97A40A40FBAB" xml:lang="en"><title>Handling |
|
13 EEikCmdExit</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>If your Symbian GUI-based application should close, for example, in |
|
15 out of memory situations, you must handle the <parmname>EEikCmdExit</parmname> command |
|
16 ID in your override of <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita#GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E/GUID-D6E5C363-CF39-3E56-B717-57CCEE8DC96F"><apiname>CEikAppUi::HandleCommandL()</apiname></xref>. The |
|
17 UI architecture of your application determines where you override <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita#GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E/GUID-D6E5C363-CF39-3E56-B717-57CCEE8DC96F"><apiname>CEikAppUi::HandleCommandL()</apiname></xref>. |
|
18 A typical implementation is as follows:</p> |
|
19 <codeblock id="GUID-80E7C5FF-A507-42FA-ACF0-808539FFF6A5" xml:space="preserve">void CMyCommandHandlingAppUi::HandleCommandL(TInt aCommand) |
|
20 { |
|
21 |
|
22 switch(aCommand) |
|
23 { |
|
24 case EEikCmdExit: |
|
25 case EAknSoftkeyExit: |
|
26 Exit(); |
|
27 break; |
|
28 |
|
29 default: |
|
30 break; |
|
31 } |
|
32 } |
|
33 </codeblock> |
|
34 <p>where <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita#GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E/GUID-6DB0AB66-DC74-33EB-9DA4-8DB6383728F9"><apiname>CEikAppUi::Exit()</apiname></xref> closes the application. <xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita"><apiname>CEikAppUi</apiname></xref> also |
|
35 provides <codeph>SaveAnyChangesL()</codeph> and <parmname>SaveL()</parmname> methods |
|
36 in case you need to save the application document.</p> |
|
37 <note> |
|
38 <p>In Symbian view architecture applications, the <parmname>EEikCmdExit</parmname> command |
|
39 must be only handled once: either in the UI controller or in a view. Since |
|
40 the exit command is an application wide command, it is recommended that it |
|
41 be handled in the UI controller implementation.</p> |
|
42 </note> |
|
43 <p><xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita#GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E/GUID-6DB0AB66-DC74-33EB-9DA4-8DB6383728F9"><apiname>CEikAppUi::Exit()</apiname></xref> exits the application. If the application |
|
44 is embedded, control returns to the parent, which should also exit. The application |
|
45 framework sends an <parmname>EEikCmdExit</parmname> command ID to each application |
|
46 in this chain to support this behavior.</p> |
|
47 <note> |
|
48 <p><xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita#GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E/GUID-6DB0AB66-DC74-33EB-9DA4-8DB6383728F9"><apiname>CEikAppUi::Exit()</apiname></xref> is guaranteed not to return. This |
|
49 means that you should not trap this method. Among other things, do not call |
|
50 another method when you handle the command ID that triggers an exit.</p> |
|
51 </note> |
|
52 </conbody></concept> |