:: Forum >>

onKeyPress fails in Opera 9.25

Hi Alex,

The following code gives an alert with the key pressed in FireFox and IE.
However, there's no alert in Opera.

Regards,
Ankur

<html>
<head>
<script src="runtime/lib/aw.js"></script>
<link href="runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<script>
var obj = new AW.Grid.Extended;
obj.setCellText(function(i, j){return j + "." + i});
obj.setHeaderText("header");

obj.setColumnCount(10);
obj.setRowCount(100);

obj.setCellEditable(false);

obj.onKeyPress = function(event) {

var key = String.fromCharCode(event.keyCode || event.charCode);
alert(key);

}

document.write(obj);
</script>
</body>
</html>
Ankur Motreja
Sunday, February 3, 2008
This is a bug in AW - onKeyPress event does not work in Opera. It will be fixed in the next release, and in the meantime you can use the following code -

obj.setEvent("onkeypress", function(event){
var key = String.fromCharCode(event.keyCode || event.charCode);
alert(key);
});


Alex (ActiveWidgets)
Monday, February 4, 2008
Fixed in AW 2.5.2.

http://www.activewidgets.com/general.bugs/2-5-2.html
Alex (ActiveWidgets)
Thursday, July 3, 2008

This topic is archived.


Back to support forum

Forum search