We can not input decimal point in NumberField under Air 1.5.
I think it is caused by the following code from the NumberField
Code:
initEvents : function(){
Ext.form.NumberField.superclass.initEvents.call(this);
var allowed = this.baseChars+'';
if(this.allowDecimals){
allowed += this.decimalSeparator;
}
if(this.allowNegative){
allowed += "-";
}
this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi');
var keyPress = function(e){
var k = e.getKey();
if(!Ext.isIE && (e.isSpecialKey() || k == e.BACKSPACE || k == e.DELETE)){
return;
}
var c = e.getCharCode();
if(allowed.indexOf(String.fromCharCode(c)) === -1){
e.stopEvent();
}
};
this.el.on("keypress", keyPress, this);
}
when pressing the decimal point key under FF/IE/Chrome, the getKey() method return 46 and it is consider to be a special key. But when in Air , the getKey() method return 190 which is not considered as a special key and the String.fromCharCode(c) method return a value '3/4' which is not equal to '.'.
I have make a dirty hack like this which can by pass this problem.
Code:
if(!Ext.isIE && (e.isSpecialKey() || k == e.BACKSPACE || k == e.DELETE || (Ext.isAir && k == 190) )){
return;
}