Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Extended keyboard

1 view
Skip to first unread message

rk...@uno.edu

unread,
Nov 24, 1993, 2:59:59 PM11/24/93
to
Does anyone know how to tell (inside a program) if the user is hitting the
arrow keys on the Sun Workstation (OS 4.1.3)? Also, what about the number
pad? In Matlab, there seems to be a difference between the number pad and
the numbers at the top of the keyboard, even if numlock is on. We do have
a program that acts like kbhit in DOS; that one does recognize the number
pad when numlock is on. Also, how do we recognize the function keys at the
very top of the keyboard?

James Vlcek

unread,
Nov 28, 1993, 7:46:29 PM11/28/93
to

How are you reading these keys, eg, (a) directly from the console (no
X), (b) through an xterm window, or are you (c) writing an X program
that deals with the actual X events?

If (a), I don't know what to tell you...

If (b), then:
od -c
and then type in all the keys you're interested in. You may want to
do them one at a time, to avoid confusion over where one key ends
and another leaves off. Some keys may not generate any input; do a
`man xterm' to find out how to set up translations for those keys
in your .Xresources file.

If (c), then:
Check out XLookupKeysym() and XLookupString(); which turn XKeyEvents
into keysyms or strings. Keysyms will tell you a sort-of hardware-
independent version of `what key you pressed' (as opposed to
keycodes, which tell you exactly which key was pressed but in a
necessarily hardware-independent way), while the strings returned
by XLookupString will give you a textual (ASCII) representation
of the key pressed (which may be more than one byte in length).

Jim Vlcek
vl...@epimbe.com

0 new messages