Visible to Intel only — GUID: GUID-CB4D007B-47BB-4853-B205-C8224F1506FE
Visible to Intel only — GUID: GUID-CB4D007B-47BB-4853-B205-C8224F1506FE
GETCHARQQ
Run-Time Function: Returns the next keystroke.
USE IFCORE
result = GETCHARQQ( )
The result type is character with length 1. The result is the character representing the key that was pressed. The value can be any ASCII character.
If the key pressed is represented by a single ASCII character, GETCHARQQ returns the character. If the key pressed is a function or direction key, a hex Z'00' or Z'E0' is returned. If you need to know which function or direction was pressed, call GETCHARQQ a second time to get the extended code for the key.
If there is no keystroke waiting in the keyboard buffer, GETCHARQQ waits until there is one, and then returns it. Compare this to the function PEEKCHARQQ, which returns .TRUE. if there is a character waiting in the keyboard buffer, and .FALSE. if not. You can use PEEKCHARQQ to determine if GETCHARQQ should be called. This can prevent a program from hanging while GETCHARQQ waits for a keystroke that isn't there. Note that PEEKCHARQQ is only supported in console applications.
If your application is a QuickWin or Standard Graphics application, you may want to put a call to PASSDIRKEYSQQ in your program. This will enable the program to get characters that would otherwise be trapped. These extra characters are described in PASSDIRKEYSQQ.
Note that the GETCHARQQ routine used in a console application is a different routine than the one used in a QuickWin or Standard Graphics application. The GETCHARQQ used with a console application does not trap characters that are used in QuickWin for a special purpose, such as scrolling. Console applications do not need, and cannot use PASSDIRKEYSQQ.
! Program to demonstrate GETCHARQQ
USE IFCORE
CHARACTER(1) key / 'A' /
PARAMETER (ESC = 27)
PARAMETER (NOREP = 0)
WRITE (*,*) ' Type a key: (or q to quit)'
! Read keys until ESC or q is pressed
DO WHILE (ICHAR (key) .NE. ESC)
key = GETCHARQQ()
! Some extended keys have no ASCII representation
IF(ICHAR(key) .EQ. NOREP) THEN
key = GETCHARQQ()
WRITE (*, 900) 'Not ASCII. Char = NA'
WRITE (*,*)
! Otherwise, there is only one key
ELSE
WRITE (*,900) 'ASCII. Char = '
WRITE (*,901) key
END IF
IF (key .EQ. 'q' ) THEN
EXIT
END IF
END DO
900 FORMAT (1X, A, \)
901 FORMAT (A)
END