Hi,
I need handle special keys (F1-F12, Esc, ...). But many of this keys are handled internaly by the browser (search, refresh, help). If I press F1 i get event from KeyPressEvent, but browser open the window with help too. I find javascript function, that can stop propagation of the event to the browser:
[CODE]
<script>
function cancelEvent(event) {
if (event.returnValue != null) {
event.keyCode = 0;
event.returnValue = false;
}
if (event.cancelBubble != null) event.cancelBubble = true;
if (event.stopPropagation) event.stopPropagation();
if (event.preventDefault) event.preventDefault();
return false;
}
document.onhelp = function () {return false;};
</script>
[\CODE]
It works corectly in IE and firefox.
Is it possible to stop propagation in smartGWT in KeyPressHandler in onKeyPress method. I try call the abov function, but I'm not able to get nativ browser event form KeyPressEvent.
Thanks Pavel
I need handle special keys (F1-F12, Esc, ...). But many of this keys are handled internaly by the browser (search, refresh, help). If I press F1 i get event from KeyPressEvent, but browser open the window with help too. I find javascript function, that can stop propagation of the event to the browser:
[CODE]
<script>
function cancelEvent(event) {
if (event.returnValue != null) {
event.keyCode = 0;
event.returnValue = false;
}
if (event.cancelBubble != null) event.cancelBubble = true;
if (event.stopPropagation) event.stopPropagation();
if (event.preventDefault) event.preventDefault();
return false;
}
document.onhelp = function () {return false;};
</script>
[\CODE]
It works corectly in IE and firefox.
Is it possible to stop propagation in smartGWT in KeyPressHandler in onKeyPress method. I try call the abov function, but I'm not able to get nativ browser event form KeyPressEvent.
Thanks Pavel
Comment