Alien-Web-ExtJS-V3
view release on metacpan or search on metacpan
share/docs/source/KeyNav.html view on Meta::CPAN
<span id='Ext-KeyNav-cfg-forceKeyDown'> /**
</span> * @cfg {Boolean} forceKeyDown
* Handle the keydown event instead of keypress (defaults to false). KeyNav automatically does this for IE since
* IE does not propagate special keys on keypress, but setting this to true will force other browsers to also
* handle keydown instead of keypress.
*/
forceKeyDown : false,
// private
relay : function(e){
var k = e.getKey(),
h = this.keyToHandler[k];
if(h && this[h]){
if(this.doRelay(e, this[h], h) !== true){
e[this.defaultEventAction]();
}
}
},
// private
doRelay : function(e, h, hname){
return h.call(this.scope || this, e, hname);
},
// possible handlers
enter : false,
left : false,
right : false,
up : false,
down : false,
tab : false,
esc : false,
pageUp : false,
pageDown : false,
del : false,
home : false,
end : false,
space : false,
// quick lookup hash
keyToHandler : {
37 : "left",
39 : "right",
38 : "up",
40 : "down",
33 : "pageUp",
34 : "pageDown",
46 : "del",
36 : "home",
35 : "end",
13 : "enter",
27 : "esc",
9 : "tab",
32 : "space"
},
stopKeyUp: function(e) {
var k = e.getKey();
if (k >= 37 && k <= 40) {
// *** bugfix - safari 2.x fires 2 keyup events on cursor keys
// *** (note: this bugfix sacrifices the "keyup" event originating from keyNav elements in Safari 2)
e.stopEvent();
}
},
<span id='Ext-KeyNav-method-destroy'> /**
</span> * Destroy this KeyNav (this is the same as calling disable).
*/
destroy: function(){
this.disable();
},
<span id='Ext-KeyNav-method-enable'> /**
</span> * Enable this KeyNav
*/
enable: function() {
if (this.disabled) {
if (Ext.isSafari2) {
// call stopKeyUp() on "keyup" event
this.el.on('keyup', this.stopKeyUp, this);
}
this.el.on(this.isKeydown()? 'keydown' : 'keypress', this.relay, this);
this.disabled = false;
}
},
<span id='Ext-KeyNav-method-disable'> /**
</span> * Disable this KeyNav
*/
disable: function() {
if (!this.disabled) {
if (Ext.isSafari2) {
// remove "keyup" event handler
this.el.un('keyup', this.stopKeyUp, this);
}
this.el.un(this.isKeydown()? 'keydown' : 'keypress', this.relay, this);
this.disabled = true;
}
},
<span id='Ext-KeyNav-method-setDisabled'> /**
</span> * Convenience function for setting disabled/enabled by boolean.
* @param {Boolean} disabled
*/
setDisabled : function(disabled){
this[disabled ? "disable" : "enable"]();
},
// private
isKeydown: function(){
return this.forceKeyDown || Ext.EventManager.useKeydown;
}
};
</pre>
</body>
</html>
( run in 0.689 second using v1.01-cache-2.11-cpan-f6376fbd888 )