Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / Element.keys.html
diff --git a/docs/source/Element.keys.html b/docs/source/Element.keys.html
new file mode 100644 (file)
index 0000000..e479d64
--- /dev/null
@@ -0,0 +1,51 @@
+<html>\r
+<head>\r
+  <title>The source code</title>\r
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body  onload="prettyPrint();">\r
+    <pre class="prettyprint lang-js">/**\r
+ * @class Ext.Element\r
+ */\r
+Ext.Element.addMethods({\r
+    <div id="method-Ext.Element-addKeyListener"></div>/**\r
+     * Convenience method for constructing a KeyMap\r
+     * @param {Number/Array/Object/String} key Either a string with the keys to listen for, the numeric key code, array of key codes or an object with the following options:\r
+     *                                  {key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}\r
+     * @param {Function} fn The function to call\r
+     * @param {Object} scope (optional) The scope of the function\r
+     * @return {Ext.KeyMap} The KeyMap created\r
+     */\r
+    addKeyListener : function(key, fn, scope){\r
+        var config;\r
+        if(!Ext.isObject(key) || Ext.isArray(key)){\r
+            config = {\r
+                key: key,\r
+                fn: fn,\r
+                scope: scope\r
+            };\r
+        }else{\r
+            config = {\r
+                key : key.key,\r
+                shift : key.shift,\r
+                ctrl : key.ctrl,\r
+                alt : key.alt,\r
+                fn: fn,\r
+                scope: scope\r
+            };\r
+        }\r
+        return new Ext.KeyMap(this, config);\r
+    },\r
+\r
+    <div id="method-Ext.Element-addKeyMap"></div>/**\r
+     * Creates a KeyMap for this element\r
+     * @param {Object} config The KeyMap config. See {@link Ext.KeyMap} for more details\r
+     * @return {Ext.KeyMap} The KeyMap created\r
+     */\r
+    addKeyMap : function(config){\r
+        return new Ext.KeyMap(this, config);\r
+    }\r
+});</pre>    \r
+</body>\r
+</html>
\ No newline at end of file