Symbian3/PDK/Source/GUID-1944C350-900E-5621-BF43-6A366844E9DD.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 16 Jul 2010 17:23:46 +0100
changeset 12 80ef3a206772
parent 9 59758314f811
child 14 578be2adaf3e
permissions -rw-r--r--
Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-1944C350-900E-5621-BF43-6A366844E9DD" xml:lang="en"><title>MenuApp: An Application with a Menu</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<section id="GUID-4DA645E1-7FBA-4777-BF59-87B54A04E539"><title>Download</title> <p>Click on the following link to
download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-a13df6fa-ad69-40b4-8923-11dbd4775915.zip" scope="external">MenuApp.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-a13df6fa-ad69-40b4-8923-11dbd4775915.html" scope="peer">browse</xref> to view the example code. </p> </section>
<section id="GUID-B412BBB6-7A38-451F-8501-4BB4B017B790"><title>Description</title> <p>This example builds on the <xref href="GUID-1D7BD70F-40A3-53FF-8150-A9CAFA4D01D8.dita">minimal</xref> UI
application by adding a menu bar and menu pane. The menu bar is defined
in a resource file, and the menu pane is populated dynamically in
the app UI's <codeph>DynInitMenuPaneL()</codeph> function. The menu
pane contains a list of all applications present on the device. If
a menu item is selected by the user, the corresponding application
is launched. </p> <p>The menu application displays a list of applications
on the menu pane: </p> <fig id="GUID-B2DD173E-A5FE-5DF3-9750-491E0A18A2B6">
<image href="GUID-2183F898-48C2-53A3-ADA0-1132EF7D4380_d0e176594_href.png" placement="inline"/>
</fig> </section>
<section id="GUID-FE3F5411-B575-4284-A841-158A65F5A9C0"><title>Class Summary</title><p><xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita"><apiname>RApaLsSession</apiname></xref></p><p><xref href="GUID-1185F595-0488-3E93-8D60-6B3A1A3AC32E.dita"><apiname>CEikAppUi</apiname></xref></p><p><xref href="GUID-F6168582-DFF1-31DF-87F9-FF2AEC5EE0FF.dita"><apiname>CEikMenuPane</apiname></xref></p></section>
<section id="GUID-8B7554ED-99FA-41A0-94A5-529FD719A40B"><title>Application list</title> <p>To create the application
list, the app UI first makes a connection to the application architecture
server, using <xref href="GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA.dita#GUID-5EEE8745-F483-33C0-A5B1-AEB5544DE2BA/GUID-A92887D0-694C-3792-B3C9-46B155FE83B9"><apiname>RApaLsSession::Connect()</apiname></xref>. Then, it
requests notification from the server that the application list is
fully populated, using <codeph>RApaLsSession::RegisterListPopulationCompleteObserver()</codeph>. When the request completes, <codeph>RApaLsSession::GetNextApp()</codeph> is called in a loop to get a list of application names and UIDs.
This list is used to populate the menu pane. </p> </section>
<section id="GUID-BA8A16BE-F0A3-429A-9D78-1E4AD833A095"><title>Launching an application</title> <p> <codeph>CEikAppUi::HandleCommandL()</codeph> handles commands based on a command ID. The <codeph>EEikCmdExit</codeph> command ID is generated by the <systemoutput>Close</systemoutput> menu option, and <codeph>HandleCommandL()</codeph> responds to it
by exiting the application. The other possible command IDs are the
UIDs of the applications in the list. This allows <codeph>CEikAppUi::HandleCommandL()</codeph> to launch applications based on the command ID. </p> <p>An application
is launched by getting the executable name (using <codeph>RApaLsSession::GetAppInfo()</codeph>), creating a command line (<codeph>CApaCommandLine</codeph>) containing
the executable name, and passing this to <codeph>RApaLsSession::StartApp()</codeph>. </p> </section>
<section id="GUID-6BD34EA5-E1B4-47C1-8D64-CFDB0E26B786"><title>Build</title> <p>The Symbian build process describes
how to build an application. </p> <p>The <filepath>MenuApp</filepath> example builds an executable called <filepath>MenuApp.exe</filepath> in the standard location (<filepath>\epoc32\release\winscw\</filepath> <i>&lt;build_variant&gt;</i> for CodeWarrior). Either launch the executable
itself, or launch the emulator and then select the <filepath>MenuApp</filepath> application from the Emulator's extras bar. </p> </section>
</conbody></concept>