Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

PASSDIRKEYSQQ

QuickWin Function: Determines the behavior of direction and page keys in a QuickWin application. This routine is only available for Windows.

Module

USE IFQWIN

result = PASSDIRKEYSQQ (val)

val

(Input) INTEGER(4) or LOGICAL(4).

A value of .TRUE. causes direction and page keys to be input as normal characters (the PassDirKeys flag is turned on). A value of .FALSE. causes direction and page keys to be used for scrolling.

The following constants, defined in IFQWIN.F90, can be used as integer arguments:

  • PASS_DIR_FALSE - Turns off any special handling of direction keys. They are not passed to the program by GETCHARQQ.

  • PASS_DIR_TRUE - Turns on special handling of direction keys. That is, they are passed to the program by GETCHARQQ.

  • PASS_DIR_INSDEL - INSERT and DELETE are also passed to the program by GETCHARQQ

  • PASS_DIR_CNTRLC - Only needed for a QuickWin application, but harmless if used with a Standard Graphics application that already passes CTRL+C.

    This value allows CTRL+C to be passed to a QuickWin program by GETCHARQQ if the following is true: the program must have removed the File menu EXIT item by using DELETEMENUQQ.

    This value also passes direction keys and INSERT and DELETE.

Results

The return value indicates the previous setting of the PassDirKeys flag.

The return data type is the same as the data type of val; that is, either INTEGER(4) or LOGICAL(4).

When the PassDirKeys flag is turned on, the mouse must be used for scrolling since the direction and page keys are treated as normal input characters.

The PASSDIRKEYSQQ function is meant to be used primarily with the GETCHARQQ and INCHARQQ functions. Do not use normal input statements (such as READ) with the PassDirKeys flag turned on, unless your program is prepared to interpret direction and page keys.

Example


use IFQWIN

logical*4 res
character*1 ch, ch1

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

123 continue
ch = getcharqq( )
! check for escapes
! 0x00 0x?? is a function key
! 0xE0 0x?? is a direction key
if (ichar(ch) .eq. 0) then
  ch1 = getcharqq()
  print *,"function key follows escape = ",ichar(ch), "  ",ichar(ch1),"  ",ch1
  goto 123
else if (ichar(ch) .eq. 224) then
  ch1 = getcharqq()
  print *,"direction key follows escape = ",ichar(ch),"  ",ichar(ch1),"  ",ch1
  goto 123
else
  print *,ichar(ch),"  ",ch

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

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

  if(ch .ne. 'X')  go to 123

endif
end

The following example uses an integer constant as an argument to PASSDIRKEYSQQ:


c=======================================================================
c
c dirkeys4.for
c
c=======================================================================
c
c     Compile/Load Input Line for Standard Graphics Full Screen Window
c
c     ifx /libs:qwins dirkeys4.for
c
c     Compile/Load Input Line for QuickWin Graphics
c
c     ifx /libs:qwin dirkeys4.for
c
c  Program to illustrate how to get almost every character
c  from the keyboard in QuickWin or Standard Graphics mode.
c  Comment out the deletemenu line for Standard Graphics mode.
c
c  If you are doing a standard graphics application,
c  control C will come in as a Z'03' without furtherc  effort.
c
c  In a QuickWin application,  The File menu Exit item must
c  be deleted, and PassDirKeysQQ called with PASS_DIR_CNTRLC
c  to get control C.
c
c=======================================================================
      use IFQWIN

      integer(4) status

      character*1 key1,key2,ch1

      write(*,*) 'Initializing'

c-----don't do this for a Standard Grapics application
c     remove File menu Exit item.
      status = deletemenuqq(1,3) ! stop QuickWin from getting control C

c-----set up to pass all keys to window including control c.
      status  = passdirkeysqq(PASS_DIR_CNTRLC)
c===============================================================
c
c     read and print characters
c
c===============================================================

   10 key1 = getcharqq()

c-----first check for control+c
      if(ichar(key1) .eq. 3) then
        write(*,*) 'Control C Received'
        write(*,*) "Really want to quit?"
        write(*,*) "Type Y <cr> to exit, or any other char <cr> to continue."
        read(*,*) ch1
        if(ch1.eq."y" .or. ch1.eq."Y") goto 30
        goto 10
      endif

      if(ichar(key1).eq.0) then ! function key?
      key2 = getcharqq()
      write(*,15) ichar(key1),ichar(key2),key2
   15 format(1x,2i12,1x,a1,' function key')
      else
      if(ichar(key1).eq.224) then ! direction key?
      key2 = getcharqq()
      write(*,16) ichar(key1),ichar(key2),key2
   16 format(1x,2i12,1x,a1,' direction key')
      else
      write(*,20) key1,ichar(key1)  ! normal key
   20 format(1x,a1,i11)
      endif
      endif
      go to 10
   30 stop
      end

See Also