Options Menu API SpecificationChanges in Options Menu API documentation
Changes in Options Menu API
Contents
PurposeOptions menus provide the user with a list of options. The selection of an option may lead to displaying a submenu. The main Options menu, if available, is displayed from an Options softkey. Menus can also be displayed from:
Menus can be added to other UI components, too.
Related APIs
API descriptionOptions Menu API provides support for a number of menus (called menu panes), each attached to a main menu bar or a menu item.
The menu support is implemented in two main classes:
All the menu pane resources of a menu bar are read on construction
and joined to form a single menu pane. This ensures that the menu panes are
stacked on top of each other, with the first pane at the bottom of the menu
pane, and the last at the top. The txt fields of
When the application is started, the menu bar is constructed and the menu bar resource is read. Whenever the menu is displayed, or the user navigates between menu panes, a menu pane is constructed and the appropriate menu pane resource is read. Use casesThe main use cases of the Options Menu API are:
API class structureOptions menu API contains little number of classes providing functionality of the interface. In the following class diagrams, the API classes are grouped together according to their roles and functionality.
Class diagram in Figure 1 shows that the API consists mainly from the
The most often used API part is
The Figure shows, that each menu pane item either generates a command to the menu observer, or opens a submenu pane (cascading).
Each menu bar has one observer:
Related APIs
Related APIs
Using the Options Menu API
Specifying menus in resource files
The first step of using menus is to specify them in resource files. The
main descriptor of a menu is the
The menu panes are collection of menu items. The items are listed in the items field. An item may open a cascading submenu. Cascading submenus are also menu pane resources:
The menu bar structure then can be linked to the
A menu bar can also be referenced in
A menu bar resource structure can directly be passed to
Related APIs
Initializing menus
In order for applications to modify the contents of the menu pane at run
time,
Adding menu itemsThe following example illustrates adding one item to the menu pane:
There is the possibility to add more than one item. The resource ID parameter
of
A new menu item can be inserted to a given position. The following example inserts a new item at the last position:
Related APIs
Removing menu itemsThe following example illustrates deleting one item from the menu pane:
There is the possibility to delete more than one item between the specified indexes. The example deletes all items from the menu pane:
When a menu pane is dismissed and opened again, items not desired have to be deleted again! Dimming a menu item simply removes the item from the menu pane. The item will not be visible at all!
Menu items not wanted are usually removed with
Related APIs
Testing the existence of menu itemsThe following example tests the existence of a given menu item:
Related APIs
Handling command IDs
When an option is activated, the observer of the menu pane is fired to
handle the activated menu command ID. It is given to
Example:
Common command IDs can be found in files:
See also Closing menus .
Related APIs
Context-sensitive menusSince each section of the menu pane is defined as a separate menu pane resource, application developers may combine menu panes to give the desired menu options for each application state. Each of the unique menu sections should be defined once as a menu pane resource, after which a menu bar resource may be defined for each application state that is required. The current menu can be changed at any time by calling
with the new menu bar resource ID, or an existing menu can be altered by simply adding new items to it or removing existing items from it.
Menu and the application UI framework give some more support to implement
context sensitive menus. The client code can specify context menu with
Some application opens a context-sensitive, simplified menu when the
OK key is pressed. It can be achieved by opening the menu in
Related APIs
Opening menusThe menu bar is shown when the user presses the Options softkey. When a UI component implements its own menu, the menu bar can be displayed (opened) with the following code:
This method constructs the correct menu bar and displays it.
Related APIs
Closing menusThe menu bar is closed when an option is selected or is canceled by the user pressing the Cancel softkey. When a UI component implements its own menu, the menu bar can be hidden (closed) with the following code:
Note that in non-
The
Related APIs
Marquee
It is possible to enable horizontal scrolling (the so called marquee) of
long menu items that do not fit into the available width. By default, marquee
is disabled. To enable marquee,
Related APIs
Indicating itemsThere are two indication types supported:
A menu can contain indicated items in it with the following constraints:
Notice that menu pane doesn't keep a track on the status of these items
and when menu is displayed again the status will be set to the one which was
specified in the resource structure unless
Items with a check mark
An item with a check mark can be created by using
Here is an example for the resource structure:
Here is an example on how to set the status of an item having a check mark:
Related APIs
Radio button groups
For the radio button group creation, the flags
If none of the items has
Here is an example of how to set the status of items in a radio button group:
Related APIs
Related APIs
Application-level hotkeysApplication-level hotkeys are not strongly connected to the Options Menu API, but one reason for mention them here is that they omit command IDs like menus.
The application UI framework enables the definition of hotkeys. A hotkey
generates a command that is handed over to the application UI’s
First of all, a hotkey resource of the type
Even if hotkeys are defined in
Related APIs
Error handlingOptions Menu API uses standard Symbian platform error reporting mechanism. Leaves and system wide error codes as function return values are used if the error is recoverable. A client application can handle these errors similarly as a normal Symbian platform application. Memory overheadMemory consumption of the Options Menu API is directly proportional to the number of menus and the number of items in each menu defined by the client. Limitations of the APIMenu bar titles are not displayed - as stated before, menu pane resources of a menu bar are read on construction and joined to form a single menu pane. The title texts and icons are not displayed at all.
Menu pane item icons are not supported. Even if the relevant methods of
Menu item text has no size limit, but at most only the first
Separators are not supported.
Menu item accelerator hotkeys are not supported:
Related APIs
|