Intel® Fortran Compiler 16.0 User and Reference Guide

INCHARQQ (W*S)

QuickWin Function: Reads a single character input from the keyboard and returns the ASCII value of that character without any buffering.

Module

USE IFQWIN

result = INCHARQQ( )

Results

The result type is INTEGER(2). The result is the ASCII key code.

The keystroke is read from the child window that currently has the focus. You must call INCHARQQ before the keystroke is made (INCHARQQ does not read the keyboard buffer). This function does not echo its input. For function keys, INCHARQQ returns 0xE0 as the upper 8 bits, and the ASCII code as the lower 8 bits.

For direction keys, INCHARQQ returns 0xF0 as the upper 8 bits, and the ASCII code as the lower 8 bits. To allow direction keys to be read, you must use the PASSDIRKEYSQQ function. The escape characters (the upper 8 bits) are different from those of GETCHARQQ. Note that console applications do not need, and cannot use PASSDIRKEYSQQ.

Example

use IFQWIN
integer*4 res
integer*2 exchar
character*1 ch, ch1

Print *,"Type X to exit, S to scroll, D to pass Direction keys"

123 continue
exchar = incharqq()
! check for escapes
! 0xE0 0x?? is a function key
! 0xF0 0x?? is a direction key

ch = char(rshift(exchar,8) .and. Z'00FF')
ch1= char(exchar .and. Z'00FF')

if (ichar(ch) .eq. 224) then
  print *,"function key  = ",ichar(ch), "  ",ichar(ch1),"  ",ch1
  goto 123
endif

if (ichar(ch) .eq. 240) then
  print *,"direction key = ",ichar(ch), "  ",ichar(ch1),"  ",ch1
  goto 123
endif

print *,"other key  = ",ichar(ch),"  ",ichar(ch1),"  ",ch1

if(ch1 .eq. 'S') then
  res = passdirkeysqq(.false.)
  print *, "Entering Scroll mode"
endif

if(ch1 .eq. 'D')  then
  res = passdirkeysqq(.true.)
  print *, "Entering Direction keys mode"
endif

if(ch1 .ne. 'X')  go to 123
end

See Also