[comp.sys.amiga] Reading key codes

utoddl@ecsvax.UUCP (Todd M. Lewis) (03/01/89)

Hello Net,

  I'm trying to set up something like what Matt does in DME so that
I can map functions to keystrokes.  But I don't want to make any
assumptions about scancodes.  DME assumes certain scan codes come
from the keypad, but the keyboard grows every couple of years and
I don't want my programs to get old and die.

  My question(s): Is there any way a program can predict (that is,
compute on the fly rather than by table look-up) which scan codes
will come from the keypad and which ones come from the main keyboard?
I know that char codes from RawKeyConvert() for keypad scan codes
stay the same regardless of IEQUALIFIERs, but that (I think)
depends on the keymap in use at the time.  I understand that RAWKEY
events have a KEYMAP bit, but that doesn't help me predict which
codes will come in that way.  You see, I want to build these tables
at program-initialization time -- before any messages get processed.

  The only thing I've been able to come up with is to have 2 identical
tables, one for the keypad and one for the rest of the keyboard.  When
an event comes in, check the KEYMAP bit and use the approprate table.
This means lots of unused table entries.  (It's also easier to code,
but it isn't clean enough for my sense of aesthetics.)

Thanks,
--Todd M. Lewis

(This disclaimer is my employers idea -- The rest are mine.)