home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
dirs
/
rexxintuition_393.lzh
/
RexxIntuition
/
Scripts
/
Keys.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1990-10-28
|
2KB
|
50 lines
/* An example of using the dissidents rx_intui.library */
wind = GetWindow('Press keys on the keyboard',,,,,,,,,)
IF wind == '' | wind == 0 THEN SAY 'Window open error'
err=SetDraw(wind,3,,1)
/* Since RAWKEY isn't one of the default IDCMP we get, we need to ask for it. */
/* I'm going to ask for IDCMP = CLOSEWINDOW (512) + RAWKEY (1024). */
/* Also, I want CONVERT_RAW (8) for the extraFlags so that I get ascii values */
/* back from the keyboard. */
err=ModIDCMP(wind,8,512+1024,)
DO WHILE class > 0
spec=WaitMsg(wind)
/* divide the spec into separate parts */
PARSE var spec class part1 part2 part3
/* Handle a RAWKEY event. Print all chars to the window except Function key, */
/* cursor key, or Help. Translate these events into appropriate messages. */
/* Press all of the keys on the keyboard, with and without the SHIFT, ALT, */
/* and CTRL keys. Note that control chars such as BACKSPACE are reverse */
/* highlighted automatically when you do a Text(). This is because its value */
/* is really 8 instead of the value of the ascii 'H' which is 72. */
IF class == 5 THEN DO
err=Erase(40,wind,5,20)
/* Now check to see if it is a Function key, cursor, or Help. */
IF part2 > 0 THEN DO
/* Now let's see whether the shift or Alt key was being held down with it */
err=Text(,wind,5,20)
IF part2 == 2 THEN err=Text('SHIFT ',wind,,)
IF part2 == 4 THEN err=Text('ALT ',wind,,)
/* If part1 is 0 to 9, then a function key */
IF part1 < 10 THEN err=Text('Function #'part1,wind,,)
/* Let's check for each cursor key and help key */
IF part1 == 10 THEN err=Text('UP cursor',wind,,)
IF part1 == 11 THEN err=Text('DOWN cursor ',wind,,)
IF part1 == 12 THEN err=Text('RIGHT cursor ',wind,,)
IF part1 == 13 THEN err=Text('LEFT cursor ',wind,,)
IF part1 == 14 THEN err=Text('Help key',wind,,)
END
/* Must not be a function, cursor, or help key if part2 == 0. So print that char */
IF part2 == 0 THEN err=Text(part1,wind,5,20)
END
END
err=EndWindow(wind)