Symbian3/PDK/Source/GUID-1944C350-900E-5621-BF43-6A366844E9DD.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 15:24:34 +0100
changeset 9 59758314f811
parent 5 f345bda72bc4
child 12 80ef3a206772
permissions -rw-r--r--
Week 23 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?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><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><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_d0e170520_href.png" placement="inline"/>
</fig> </section>
<section><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><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><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><title>Build</title> <p>The <xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">Symbian
build process</xref> 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>