input-devices-$10.lzx
<canvas width="100%" height="200" debug="true">
<debug x="110" y="15"/>
<view width="100" height="100" bgcolor="0x333399" focusable="true" oninit="lz.Focus.setFocus(this)">
<handler name="oninit">
this.keyCodes = new Array()
this.keyCodes[65] = "A for Apple";
this.keyCodes[76] = "L for Laszlo";
this.keyCodes[79] = "O for Optometrist";
this.keyCodes[83] = "S for Sammy";
this.keyCodes[90] = "Z for Zebra";
</handler>
<handler name="onkeydown" args="akeycode">
// respond here
Debug.debug("Key pressed: %w", akeycode);
if ( this.keyCodes[akeycode] != undefined ) {
Debug.debug("%s", this.keyCodes[akeycode] );
} else {
Debug.debug("You pressed: %w", String.fromCharCode(akeycode));
}
</handler>
</view>
</canvas>
Cross References