CommandManager.installKey Member

Internal. Installs the accelerator key for a single command.

Syntax

object.installKey(parentElem, command);

Arguments

ArgumentSummary
parentElem An XULElement to add the <key> too.
command The CommandRecord to install.

Returns

Remarks

This creates a <key> XUL element inside parentElem.  It should usually be called once per command, per document, so that accelerator keys work in all application windows.

See Also

Source Code

function cmgr_instkey(parentElem, command)
{
if (!command.keystr)
return;
var ary = command.keystr.match (/(.*\s)?([\S]+)$/);
if (!ASSERT(ary, "couldn't parse key string ``" + command.keystr +
"'' for command ``" + command.name + "''"))
{
return;
}
var key = document.createElement ("key");
key.setAttribute ("id", "key:" + command.name);
key.setAttribute ("oncommand", "dispatch('" + command.name +
"', {isInteractive: true, source: 'keyboard'});");
if (ary[1])
key.setAttribute ("modifiers", ary[1]);
if (ary[2].indexOf("VK_") == 0)
key.setAttribute ("keycode", ary[2]);
else
key.setAttribute ("key", ary[2]);
parentElem.appendChild(key);
command.keyNodes.push(key);
}