Package: | Roo |
Defined In: | Roo/KeyMap.js. |
Class: | KeyMap |
// map one key by key code
var map = new Roo.KeyMap("my-element", {
key: 13, // or Roo.EventObject.ENTER
fn: myHandler,
scope: myObject
});
// map multiple keys to one action by string
var map = new Roo.KeyMap("my-element", {
key: "a\r\n\t",
fn: myHandler,
scope: myObject
});
// map multiple keys to multiple actions by strings and array of codes
var map = new Roo.KeyMap("my-element", [
{
key: [10,13],
fn: function(){ alert("Return was pressed"); }
}, {
key: "abc",
fn: function(){ alert('a, b or c was pressed'); }
}, {
key: "\t",
ctrl:true,
shift:true,
fn: function(){ alert('Control + shift + tab was pressed.'); }
}
]);
Method | Defined By | |
---|---|---|
addBinding
(Object/Array config)
Add a new binding to this KeyMap.
Add a new binding to this KeyMap. The following config object properties are supported:
Usage:
|
Roo.KeyMap | |
disable
()
Disable this KeyMap
Disable this KeyMap
|
Roo.KeyMap | |
enable
()
Enables this KeyMap
Enables this KeyMap
|
Roo.KeyMap | |
isEnabled
()
:
Boolean
Returns true if this KeyMap is enabled
Returns true if this KeyMap is enabled
|
Roo.KeyMap | |
Shorthand for adding a single key listener
Shorthand for adding a single key listener
|
Roo.KeyMap |