Subj. The straightforward approach (example below) doesn't seem to
work, at least on the simulator. It does intercept the keyboard
buttons but not the up/down/left/right "joystick" keys. BTW, without
an <input> element on the page (or, I guess, something else to take
focus) this code doesn't see even the keyboard presses -- everything
goes straight to the search bar. Is this a missing feature, or is
there a trick to it?
Regards,
...Max...
================
<html>
<head>
<script type="text/javascript">
function log( txt )
{
document.getElementById( 'log' ).appendChild( document.createTextNode( txt ) );
document.getElementById( 'log' ).appendChild( document.createElement( 'br' ) );
}
function str(e)
{
var s = '';
if( 'charCode' in e ) s += ' charCode=' + e.charCode;
if( 'keyCode' in e ) s += ' keyCode=' + e.keyCode;
return s;
}
function onKeyDown(e)
{
log( 'onkeydown: ' + str(e) );
}
function onKeyUp(e)
{
log( 'onkeyup: ' + str(e) );
}
function onKeyPress(e)
{
log( 'onkeypress: ' + str(e) );
}
function runOnLoad()
{
document.onkeydown = onKeyDown;
document.onkeyup = onKeyUp;
document.onkeypress = onKeyPress;
}
</script>
</head>
<body onload='runOnLoad()'>
<input type='text'>
<div id="log"></div>
</body>
</html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---