home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / BASIC / POWBASIC / LIBRARY3 / VPRNT.ZIP / VPDEMO1.BAS < prev    next >
BASIC Source File  |  1990-02-15  |  2KB  |  88 lines

  1.  $COMPILE EXE
  2.  $lib All OFF
  3.  $ERROR ALL OFF
  4.  DEFINT a-z
  5.  %False = 0
  6.  %True = NOT %False
  7.  PUBLIC Vpatr
  8.  ' Demo
  9.  ' This is a demo of ViewPrint for PowerBASIC
  10.  ' See ViewPrnt.Doc for details
  11.  ' Copr. Barry Erick 1989, 1990
  12.  
  13.  COLOR 0,7
  14.  origColor = SetVpatr(7,1)
  15.  CLS
  16.  ' Now fill the screen
  17.  FOR y = 1 TO 25
  18.      LOCATE y,3
  19.      FOR x = 1 TO 7
  20.          PRINT "PowerBASIC ";
  21.      NEXT
  22.      IF y < 24 THEN PRINT
  23.  
  24.  NEXT
  25.  ' use the same attribute that the screen uses, grey on blue
  26.  Vpatr =  SETVPATR(7,0)
  27.  ' now open a viewport. This also clears the window
  28.  CALL ViewPrint(11,17)
  29.  CALL ClsVpWind
  30.  x = 1
  31.  ' until a key is hit, print the line number within the view port
  32.  DO UNTIL INSTAT
  33.      IF x = 65 THEN
  34.         flag = %false
  35.      END IF
  36.      IF x = 1 THEN
  37.         flag = %True
  38.      END IF
  39.      IF Flag THEN
  40.         INCR x
  41.      ELSE
  42.         DECR x
  43.      END IF
  44.      IF x = 0 THEN x = 1
  45.      A$=SPACE$(79)
  46.      MID$(a$,x)="Hit any key"+STR$(x)
  47.      CALL Vprint(a$)
  48.  LOOP
  49.  
  50.  'throw away the key that was hit
  51.  Dummy$ = INKEY$
  52.  
  53.  'make a empty line for us to use
  54.  CALL Vprintck
  55.  
  56.  'and indent to position 2 on that line
  57.  CALL VpLocate(-1,2)
  58.  num = 18754.34
  59.  
  60.  'and use a normal PB command or two
  61.  PRINT "A formatted"," number is ";
  62.  PRINT USING "#########.##";num
  63.  
  64.  'now get to the next line by checking if a scroll is needed
  65.  CALL VprintCk
  66.  
  67.  'and indent to column 2 again
  68.  CALL VpLocate (-1,2)
  69.  
  70.  ' and use a normal PB command again
  71.  INPUT "What is your name";na$
  72.  
  73.  'and check the next line
  74.  CALL Vprintck
  75.  
  76.  'and indent again (VPLoate is not needed if we don't indent)
  77.  CALL VpLocate(-1,2)
  78.  
  79.  'Again, use a PB command
  80.  PRINT "Hello ";na$;
  81.  
  82.  'and allow the screen to stay active awhile so we can see it if in the IDE
  83.  DELAY 1.24
  84.  
  85.  CLS
  86.  
  87.  $LINK "Vp1.Pbu"
  88.