home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
wps
/
editor
/
epmtools
/
epmsmp
/
testkeys.e
< prev
next >
Wrap
Text File
|
1992-08-26
|
2KB
|
55 lines
; A blank keyset which lets you see what the internal values for keys are.
; Note that if EPM control 26 is on, then arrows are handled internally,
; and won't be seen by this routine. TOGGLECONTROL 26 0 to turn that off.
; By Larry Margolis
defc testkeys
universal TEST_STARTING_KEYSET
if .keyset = 'TEST_KEYS' then
sayerror 'Already in testkeys mode. Command ignored.'
return
endif
TEST_starting_keyset = upcase(.keyset)
keys testkeys
sayerror 'Press Esc or End key twice to exit.'
defkeys testkeys new clear
def otherkeys =
universal TEST_STARTING_KEYSET
k = lastkey()
msg = ''
if length(k)=1 then
ch = 'chr('asc(k)')'
else
ch = "x'"rightstr(itoa(leftstr(k,1)\0,16),2,0) || rightstr(itoa(substr(k,2,1)\0,16),2,0)"'"
if k=space then
ch = ch '(Space)'
elseif k=s_space then
ch = ch '(Shift+Space)'
elseif k = \10\18 then
ch = ch '(Ctrl)'
elseif k = \09\10 then
ch = ch '(Shift)'
elseif k = \11\34 then
ch = ch '(Alt)'
endif
if k=\x13\x02 | k=\x0f\x02 then -- Esc or End
if lastkey(1) = k then
.keyset = TEST_STARTING_KEYSET
call beep(900,100)
sayerror 'Back to keyset' .keyset
return
endif
msg = 'Press again to exit testkeys.'
endif
endif
compile if 1 -- 1 if you want to
keys edit_keys -- switch to the starting keyset,
executekey k -- execute the pressed key,
keys testkeys -- then switch back.
compile endif
sayerror 'key =' ch '= "'k'"' msg