×
Namespaces

Variants
Actions

Defining shortcut keys for a Symbian app

From Nokia Developer Wiki
Jump to: navigation, search

This code snippet shows how to create hotkeys/shortcutkeys in your Symbian C++ application; Shortcut keys allow you to invoke a commands using arbitrary key-press combinations, and are useful for applications that run on devices with keyboards.

Article Metadata
Article
Created: vasant21 (10 May 2007)
Last edited: hamishwillee (25 Jan 2012)

Source code

Application shortcut keys are defined in a HOTKEYS resource your application's .rss file.

RESOURCE HOTKEYS r_yourapplicationname_hotkeys
{
control =
{
HOTKEY
{
command = EEikCmdExit;
key = "e";
}
};
}

The application's shortcut keys are defined in a HOTKEYS resource, identified by the symbolic ID r_yourapplicationname_hotkeys, which ties in with the symbolic ID given below in the EIK_APP_INFO resource:

RESOURCE RSS_SIGNATURE { }
RESOURCE TBUF { buf=""; }
 
RESOURCE EIK_APP_INFO
{
menubar = r_yourapplicationame_menubar;
hotkeys = r_yourapplicationame_hotkeys;
}

The RSS_SIGNATURE allows to specify version information, but its not used here. The TBUF allows to specify a friendly name for default file, it is also not used here , since this isn't a file-based application.Of more interest is the EIK_APP_INFO resource, which, in this case, identifies the symbolic resource IDs of the menu and shortcut keys.

This page was last modified on 25 January 2012, at 06:01.
52 page views in the last 30 days.