home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / utilities / utilsp / pgplot / Examples / f77 / PGDemo6 < prev    next >
Encoding:
Text File  |  1994-02-24  |  1.9 KB  |  56 lines

  1.       PROGRAM PGDEM6
  2. C-----------------------------------------------------------------------
  3. C Test program for PGPLOT: test of Cursor
  4. C-----------------------------------------------------------------------
  5.       INTEGER PGBEG, PGCURS
  6.       INTEGER JUNK
  7.       CHARACTER*1 CH
  8.       REAL X,Y
  9. C
  10.       WRITE(*,*) '   This program demonstrates the use of routine',
  11.      :             ' PGCURS. It'
  12.       WRITE(*,*) '   requires a graphics device with a cursor.',
  13.      :             ' Position the cursor'
  14.       WRITE(*,*) '   anywhere in the window. Press any key (or a mouse',
  15.      :             ' button if'
  16.       WRITE(*,*) '   the device has a mouse supported by PGPLOT); the',
  17.      :             ' program'
  18.       WRITE(*,*) '   draws a marker at the current cursor position and',
  19.      :             ' reports the'
  20.       WRITE(*,*) '   current cursor position [bottom left corner is',
  21.      :             ' (0,0); top'
  22.       WRITE(*,*) '   right is (1,1)] and the ASCII code of the key',
  23.      :             ' that you'
  24.       WRITE(*,*) '   pressed. To exit from the program, type a slash',
  25.      :             ' (/), ctrl-D,'
  26.       WRITE(*,*) '   or ctrl-Z.'
  27. C
  28. C Open device for graphics.
  29. C
  30.       IF (PGBEG(0,'?',1,1) .NE. 1) STOP
  31. C
  32. C Clear the screen. Draw a frame at the physical extremities of the
  33. C plot, using full-screen viewport and standard window.
  34. C
  35.       CALL PGPAGE
  36.       CALL PGSVP(0.0,1.0,0.0,1.0)
  37.       CALL PGSWIN(0.0,1.0,0.0,1.0)
  38.       CALL PGBOX('bcts',0.1,5,'bcts',0.1,5)
  39. C
  40. C Loop to read and display cursor position. Initial position for cursor
  41. C is center of viewport. 
  42. C
  43.       X = 0.5
  44.       Y = 0.5
  45.    10 CONTINUE
  46.           JUNK = PGCURS(X,Y,CH)
  47.           CALL PGPT(1, X, Y, ICHAR(CH))
  48.           WRITE (*, '(2F8.3,I4)') X,Y,ICHAR(CH)
  49.       IF (CH.NE.'/'.AND. CH.NE.CHAR(0) .AND. CH.NE.CHAR(4) .AND.
  50.      :    CH.NE.CHAR(26)) GOTO 10
  51. C
  52. C Close the device and exit.
  53. C
  54.       CALL PGEND
  55.       END
  56.