MenuApp: An Application with a Menu

Download

Click on the following link to download the example: MenuApp.zip

Click: browse to view the example code.

Description

This example builds on the minimal 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 DynInitMenuPaneL() 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.

The menu application displays a list of applications on the menu pane:

Class Summary

RApaLsSession

CEikAppUi

CEikMenuPane

Application list

To create the application list, the app UI first makes a connection to the application architecture server, using RApaLsSession::Connect(). Then, it requests notification from the server that the application list is fully populated, using RApaLsSession::RegisterListPopulationCompleteObserver(). When the request completes, RApaLsSession::GetNextApp() is called in a loop to get a list of application names and UIDs. This list is used to populate the menu pane.

Launching an application

CEikAppUi::HandleCommandL() handles commands based on a command ID. The EEikCmdExit command ID is generated by the Close menu option, and HandleCommandL() responds to it by exiting the application. The other possible command IDs are the UIDs of the applications in the list. This allows CEikAppUi::HandleCommandL() to launch applications based on the command ID.

An application is launched by getting the executable name (using RApaLsSession::GetAppInfo()), creating a command line (CApaCommandLine) containing the executable name, and passing this to RApaLsSession::StartApp().

Build

The Symbian build process describes how to build an application.

The MenuApp example builds an executable called MenuApp.exe in the standard location (\epoc32\release\winscw\ <build_variant> for CodeWarrior). Either launch the executable itself, or launch the emulator and then select the MenuApp application from the Emulator's extras bar.