Disabling hardware key shortcuts

This document describes how to disable hardware key shortcuts when none of the items in a list are highlighted.

If an application has item-specific hardware key shortcuts, they must be disabled when there are no visible highlights in lists.

  • Applications must retrieve the list highlighted state using the CEikMenuBar::ItemSpecificCommandsEnabled() function. The function returns ETrue when item-specific commands are enabled in the menu bar (that is, a list has highlighted options) and EFalse when they are disabled (the list does not have highlighted options).

    Note: Symbian^3 supports focused items on hybrid devices when the UI is manipulated through key events. For details, see

    Moving in hybrid devices

    For example, considering that an application supports single-tap, the following code enables the delete action only if the call to ItemSpecificCommandsEnabled indicates that an item is currently focused.

    TBool CLogsRecentListView::ProcessKeyEventL(
    const TKeyEvent& aKeyEvent,
    TEventCode aType )
    {
      if( aType == EEventKey )
      {
        if( MenuBar()->ItemSpecificCommandsEnabled() && aKeyEvent.iCode == EKeyBackspace )
        {
          HandleCommandL( ELogsCmdMenuDelete );
          return ETrue;
        }
      }
    }