next up previous contents index
Next: Input Initialization Up: Example Programs Previous: Text Fonts

Request Input

This program demonstrates REQUEST input for the Choice, Locator, Valuator and String input classes. It prompts for locator positions corresponding to the vertices of a polygon, and indicates them with markers. Request Choice is then used to find out the interior style for the fill area, and a title is requested for the picture. The character height of the title is selected using valuator input and is followed by another locator request so that the operator can position the text on the screen.

      PROGRAM INP
      INCLUDE  'GKS$GTSDEV'
      INCLUDE  'GKS$ENUM'
C
      INTEGER      errfil
      PARAMETER   (errfil=6)
      INTEGER      wktyp, wkid,  conid
      PARAMETER   (wkid = 1, conid = 1)
      INTEGER      chcdev, locdev, strdev, valdev  ! device numbers
      PARAMETER   (chcdev = 1, locdev = 1, strdev = 1, valdev = 1)
      INTEGER      tnr, i, status
      INTEGER      lstr, nsides, fill
      REAL         px(10), py(10)
      REAL         chrht, sides
      INTEGER      errind             ! error flag
      CHARACTER*80 str
      INTEGER      asflst(13)
      DATA         asflst/13 * gindiv/! set all ASFs
C
C     Open error log file, GKS and a Workstation
C
      OPEN (unit=errfil, file='errors', status='unknown')
      wktyp = T4107                   ! set workstation type
      CALL gopks(errfil, 0)           ! open gks (bufa not used)
      CALL gopwk(wkid, conid, wktyp)  ! open workstation
      CALL gacwk(wkid)                ! activate workstation
      CALL gsasf(asflst)              ! set attributes individually
C
C     request locator positions
C
      nsides = 6                      ! Why not a hexagon?
      CALL gmsg(wkid, 'Point to 6 vertices')
      DO 30 i = 1, nsides
         CALL grqlc(wkid, locdev, status, tnr, px(i), py(i))
         CALL gpm(1, px(i), py(i))    ! Plot positions
30    CONTINUE
C
C     Request choice for fill area interior style
C
50    CALL gmsg(wkid, 'Type 1-4: hollow,solid,pattern,hatch')
      CALL grqch(wkid, chcdev, status, fill)
      CALL gsfais(fill-1)             ! Set fill area style
      CALL gfa(nsides, px, py)        ! Draw fill area
C
C     Request string for title of picture
C
      CALL gmsg(wkid, 'Give the title of the picture')
      CALL grqst(wkid, strdev, status, lstr, str)
C
C     Request valuator for CHARACTER height
C
      CALL gmsg(wkid, 'Give CHARACTER height (0.01 to 0.1)')
      CALL grqvl(wkid, valdev, status, chrht)
      CALL gschh(chrht)
C
C     Request locator for text position
C
      CALL gmsg(wkid, 'Give text position')
      CALL grqlc(wkid, locdev, status, tnr, px(1), py(1))
      CALL gstxfp(1, gstrkp)          ! font 1, stroke precision
      CALL gtx(px(1), py(1), str(1:lstr))
      CALL gdawk(wkid)                ! deactivate workstation
      CALL gclwk(wkid)                ! close workstation
      CALL gclks                      ! close gks
      END

Janne Saarela
Mon Apr 3 17:00:12 METDST 1995