Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / output / Ext.util.KeyMap.js
1 Ext.data.JsonP.Ext_util_KeyMap({
2   "tagname": "class",
3   "name": "Ext.util.KeyMap",
4   "doc": "<p>Handles mapping keys to actions for an element. One key map can be used for multiple actions.\nThe constructor accepts the same config object as defined by <a href=\"#/api/Ext.util.KeyMap-method-addBinding\" rel=\"Ext.util.KeyMap-method-addBinding\" class=\"docClass\">addBinding</a>.\nIf you bind a callback function to a KeyMap, anytime the KeyMap handles an expected key\ncombination it will call the function with this signature (if the match is a multi-key\ncombination the callback will still be called only once): (String key, <a href=\"#/api/Ext.EventObject\" rel=\"Ext.EventObject\" class=\"docClass\">Ext.EventObject</a> e)\nA KeyMap can also handle a string representation of keys.<br />\nUsage:</p>\n\n<pre><code>// map one key by key code\nvar map = new Ext.util.KeyMap(\"my-element\", {\n    key: 13, // or Ext.EventObject.ENTER\n    fn: myHandler,\n    scope: myObject\n});\n\n// map multiple keys to one action by string\nvar map = new Ext.util.KeyMap(\"my-element\", {\n    key: \"a\\r\\n\\t\",\n    fn: myHandler,\n    scope: myObject\n});\n\n// map multiple keys to multiple actions by strings and array of codes\nvar map = new Ext.util.KeyMap(\"my-element\", [\n    {\n        key: [10,13],\n        fn: function(){ alert(\"Return was pressed\"); }\n    }, {\n        key: \"abc\",\n        fn: function(){ alert('a, b or c was pressed'); }\n    }, {\n        key: \"\\t\",\n        ctrl:true,\n        shift:true,\n        fn: function(){ alert('Control + shift + tab was pressed.'); }\n    }\n]);\n</code></pre>\n\n\n<p><b>Note: A KeyMap starts enabled</b></p>\n",
5   "extends": null,
6   "mixins": [
7
8   ],
9   "alternateClassNames": [
10     "Ext.KeyMap"
11   ],
12   "xtype": null,
13   "author": null,
14   "docauthor": null,
15   "singleton": false,
16   "private": false,
17   "cfg": [
18
19   ],
20   "method": [
21     {
22       "tagname": "method",
23       "name": "KeyMap",
24       "member": "Ext.util.KeyMap",
25       "doc": "\n",
26       "params": [
27         {
28           "type": "Mixed",
29           "name": "el",
30           "doc": "<p>The element to bind to</p>\n",
31           "optional": false
32         },
33         {
34           "type": "Object",
35           "name": "binding",
36           "doc": "<p>The binding (see <a href=\"#/api/Ext.util.KeyMap-method-addBinding\" rel=\"Ext.util.KeyMap-method-addBinding\" class=\"docClass\">addBinding</a>)</p>\n",
37           "optional": false
38         },
39         {
40           "type": "String",
41           "name": "eventName",
42           "doc": "<p>(optional) The event to bind to (defaults to \"keydown\")</p>\n",
43           "optional": true
44         }
45       ],
46       "return": {
47         "type": "void",
48         "doc": "\n"
49       },
50       "private": false,
51       "static": false,
52       "filename": "/Users/nick/Projects/sencha/SDK/extjs/src/util/KeyMap.js",
53       "linenr": 1,
54       "html_filename": "KeyMap.html",
55       "href": "KeyMap.html#Ext-util-KeyMap-method-constructor",
56       "shortDoc": "\n"
57     },
58     {
59       "tagname": "method",
60       "name": "addBinding",
61       "member": "Ext.util.KeyMap",
62       "doc": "<p>Add a new binding to this KeyMap. The following config object properties are supported:</p>\n\n<pre>Property            Type             Description\n----------          ---------------  ----------------------------------------------------------------------\nkey                 String/Array     A single keycode or an array of keycodes to handle\nshift               Boolean          True to handle key only when shift is pressed, False to handle the key only when shift is not pressed (defaults to undefined)\nctrl                Boolean          True to handle key only when ctrl is pressed, False to handle the key only when ctrl is not pressed (defaults to undefined)\nalt                 Boolean          True to handle key only when alt is pressed, False to handle the key only when alt is not pressed (defaults to undefined)\nhandler             Function         The function to call when KeyMap finds the expected key combination\nfn                  Function         Alias of handler (for backwards-compatibility)\nscope               Object           The scope of the callback function\ndefaultEventAction  String           A default action to apply to the event. Possible values are: stopEvent, stopPropagation, preventDefault. If no value is set no action is performed. \n</pre>\n\n\n<p>Usage:</p>\n\n<pre><code>// Create a KeyMap\nvar map = new Ext.util.KeyMap(document, {\n    key: Ext.EventObject.ENTER,\n    fn: handleKey,\n    scope: this\n});\n\n//Add a new binding to the existing KeyMap later\nmap.addBinding({\n    key: 'abc',\n    shift: true,\n    fn: handleKey,\n    scope: this\n});\n</code></pre>\n\n",
63       "params": [
64         {
65           "type": "Object/Array",
66           "name": "binding",
67           "doc": "<p>A single KeyMap config or an array of configs</p>\n",
68           "optional": false
69         }
70       ],
71       "return": {
72         "type": "void",
73         "doc": "\n"
74       },
75       "private": false,
76       "static": false,
77       "filename": "/Users/nick/Projects/sencha/SDK/extjs/src/util/KeyMap.js",
78       "linenr": 66,
79       "html_filename": "KeyMap.html",
80       "href": "KeyMap.html#Ext-util-KeyMap-method-addBinding",
81       "shortDoc": "Add a new binding to this KeyMap. The following config object properties are supported:\n\nProperty            Type    ..."
82     },
83     {
84       "tagname": "method",
85       "name": "destroy",
86       "member": "Ext.util.KeyMap",
87       "doc": "<p>Destroys the KeyMap instance and removes all handlers.</p>\n",
88       "params": [
89         {
90           "type": "Boolean",
91           "name": "removeEl",
92           "doc": "<p>True to also remove the attached element</p>\n",
93           "optional": false
94         }
95       ],
96       "return": {
97         "type": "void",
98         "doc": "\n"
99       },
100       "private": false,
101       "static": false,
102       "filename": "/Users/nick/Projects/sencha/SDK/extjs/src/util/KeyMap.js",
103       "linenr": 295,
104       "html_filename": "KeyMap.html",
105       "href": "KeyMap.html#Ext-util-KeyMap-method-destroy",
106       "shortDoc": "<p>Destroys the KeyMap instance and removes all handlers.</p>\n"
107     },
108     {
109       "tagname": "method",
110       "name": "disable",
111       "member": "Ext.util.KeyMap",
112       "doc": "<p>Disable this KeyMap</p>\n",
113       "params": [
114
115       ],
116       "return": {
117         "type": "void",
118         "doc": "\n"
119       },
120       "private": false,
121       "static": false,
122       "filename": "/Users/nick/Projects/sencha/SDK/extjs/src/util/KeyMap.js",
123       "linenr": 273,
124       "html_filename": "KeyMap.html",
125       "href": "KeyMap.html#Ext-util-KeyMap-method-disable",
126       "shortDoc": "<p>Disable this KeyMap</p>\n"
127     },
128     {
129       "tagname": "method",
130       "name": "enable",
131       "member": "Ext.util.KeyMap",
132       "doc": "<p>Enables this KeyMap</p>\n",
133       "params": [
134
135       ],
136       "return": {
137         "type": "void",
138         "doc": "\n"
139       },
140       "private": false,
141       "static": false,
142       "filename": "/Users/nick/Projects/sencha/SDK/extjs/src/util/KeyMap.js",
143       "linenr": 263,
144       "html_filename": "KeyMap.html",
145       "href": "KeyMap.html#Ext-util-KeyMap-method-enable",
146       "shortDoc": "<p>Enables this KeyMap</p>\n"
147     },
148     {
149       "tagname": "method",
150       "name": "isEnabled",
151       "member": "Ext.util.KeyMap",
152       "doc": "<p>Returns true if this KeyMap is enabled</p>\n",
153       "params": [
154
155       ],
156       "return": {
157         "type": "Boolean",
158         "doc": "\n"
159       },
160       "private": false,
161       "static": false,
162       "filename": "/Users/nick/Projects/sencha/SDK/extjs/src/util/KeyMap.js",
163       "linenr": 255,
164       "html_filename": "KeyMap.html",
165       "href": "KeyMap.html#Ext-util-KeyMap-method-isEnabled",
166       "shortDoc": "<p>Returns true if this KeyMap is enabled</p>\n"
167     },
168     {
169       "tagname": "method",
170       "name": "on",
171       "member": "Ext.util.KeyMap",
172       "doc": "<p>Shorthand for adding a single key listener</p>\n",
173       "params": [
174         {
175           "type": "Number/Array/Object",
176           "name": "key",
177           "doc": "<p>Either the numeric key code, array of key codes or an object with the\nfollowing options:\n{key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}</p>\n",
178           "optional": false
179         },
180         {
181           "type": "Function",
182           "name": "fn",
183           "doc": "<p>The function to call</p>\n",
184           "optional": false
185         },
186         {
187           "type": "Object",
188           "name": "scope",
189           "doc": "<p>(optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the browser window.</p>\n",
190           "optional": true
191         }
192       ],
193       "return": {
194         "type": "void",
195         "doc": "\n"
196       },
197       "private": false,
198       "static": false,
199       "filename": "/Users/nick/Projects/sencha/SDK/extjs/src/util/KeyMap.js",
200       "linenr": 227,
201       "html_filename": "KeyMap.html",
202       "href": "KeyMap.html#Ext-util-KeyMap-method-on",
203       "shortDoc": "<p>Shorthand for adding a single key listener</p>\n"
204     },
205     {
206       "tagname": "method",
207       "name": "setDisabled",
208       "member": "Ext.util.KeyMap",
209       "doc": "<p>Convenience function for setting disabled/enabled by boolean.</p>\n",
210       "params": [
211         {
212           "type": "Boolean",
213           "name": "disabled",
214           "doc": "\n",
215           "optional": false
216         }
217       ],
218       "return": {
219         "type": "void",
220         "doc": "\n"
221       },
222       "private": false,
223       "static": false,
224       "filename": "/Users/nick/Projects/sencha/SDK/extjs/src/util/KeyMap.js",
225       "linenr": 283,
226       "html_filename": "KeyMap.html",
227       "href": "KeyMap.html#Ext-util-KeyMap-method-setDisabled",
228       "shortDoc": "<p>Convenience function for setting disabled/enabled by boolean.</p>\n"
229     }
230   ],
231   "property": [
232
233   ],
234   "event": [
235
236   ],
237   "filename": "/Users/nick/Projects/sencha/SDK/extjs/src/util/KeyMap.js",
238   "linenr": 1,
239   "html_filename": "KeyMap.html",
240   "href": "KeyMap.html#Ext-util-KeyMap",
241   "cssVar": [
242
243   ],
244   "cssMixin": [
245
246   ],
247   "component": false,
248   "superclasses": [
249
250   ],
251   "subclasses": [
252
253   ],
254   "mixedInto": [
255
256   ],
257   "allMixins": [
258
259   ]
260 });