View Full Version : [Solved]Is there a better way to get key constants

6 Jul 2009, 3:17 PM
The only way I can see to get to the constants to set up key maps is through Ext.EventObjectImpl.prototype

such as Ext.EventObjectImpl.prototype.ENTER

While ENTER is a trivial one, it sure would make the code nicer if there was a short cut to all the key codes. Am I missing it? Should I do something like

var myKeys = Ext.EventObjectImpl.prototype;

Then use myKeys.ENTER

6 Jul 2009, 4:08 PM
If you have an event object already just use


6 Jul 2009, 4:34 PM
I don't in this case. I wanted to use the constants to set up my keymap. Makes for clear code when you go back to it in the future.

6 Jul 2009, 4:36 PM
Ext.EventObject.ENTER will work.

Similarly, if you're setting up a heap:

var e = Ext.EventObject;
e.ENTER; //etc

6 Jul 2009, 4:43 PM
Ah, thanks. Thats a lot cleaner looking.