Hiding
item-specific commands in menus
The item-specific commands and item-action commands in options
menu must be flagged with the EEikMenuItemSpecific and EEikMenuItemAction flags
introduced in Symbian^3. This enables the UI framework to hide them in the
options menu and display them only in the stylus pop-up menu. The touch down
and hold action opens the stylus pop-up menu. Touch down and release performs
an action.
Actions like opening
a radio button list and virtual input are performed on the first tap. These
actions are normally handled by the UI framework. However, if your application
contains an implementation of its own for handling these actions (for example,
opening a custom component on the second tap) it must be changed to follow
the single-tap style.
- Add the EEikMenuItemAction flag
to all item-action commands in your options menu resource definitions. Menu
item-action commands are functions that are called during touch down and release
on an item (for example, Open action).
For example,
/**
*AppList View menuitems (Counters)
*/
RESOURCE MENU_PANE r_logs_applist_menu
{
items =
{
MENU_ITEM
{
command = ELogsCmdMenuOpen;
txt = qtn_logs_cmd_open;
//---------------------------------------------------------------
// Include the following line to the list-item action commands
flags =EEikMenuItemAction;
//----------------------------------------------------------------
}
};
}
- Add the EEikMenuItemSpecific flag
to all (other than item-action) item-specific commands in options menu resource
definitions.
For example,
RESOURCE MENU_PANE r_common_event_menu_send_events
{
items =
{
MENU_ITEM /* Send */
{
command = ELogsCmdMenuSendUi;
txt = qtn_stm_om_send;
//-------------------------------------------------------------------------
//Add the following line to the list item-specific commands
flags = EEikMenuItemSpecific;
//-------------------------------------------------------------------------
},
MENU_ITEM /* Clear list */
{ command = ELogsCmdMenuDeleteAll;
txt = qtn_stm_om_delete_all; }
};
}
Note: An application view containing
forms need
not flag item-specific commands, as forms are always highlighted.
- If your application
code dynamically adds or removes menu items, you must change
the flag value of the menu pane using the CEikMenuPane::SetItemSpecific() function.
For example,
/* Add send message item to menu above position pos */
TInt pos = 0;
/* Returns pointer to menu item */
aMenuPane->ItemAndPos(ELogsCmdMenuSendUi, pos);
/* Delete marker item from menu */
aMenuPane->DeleteMenuItem(ELogsCmdMenuSendUi);
/* No need here yet to tailor subitems in SendUi menu */
TSendingCapabilities capabilities(0, 0, 0);
LogsAppUi()
->
SendUiL()
->AddSendMenuItemL
(
*aMenuPane, pos, /* Position in menupane */ ELogsCmdMenuSendUi, /* Command id to be used for "Send" menu item */
capabilities
);
aMenuPane->SetItemTextL(ELogsCmdMenuSendUi, iSendUiText->Des());
//-------------------------------------------------------------
// Include the following line to dynamically change the flag value
aMenuPane->SetItemSpecific(ELogsCmdMenuSendUi, ETrue);
//-----------------------------------------------------------------
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.