home *** CD-ROM | disk | FTP | other *** search
- $COMPILE EXE
- $lib All OFF
- $ERROR ALL OFF
- DEFINT a-z
- %False = 0
- %True = NOT %False
- PUBLIC Vpatr
- ' Demo
- ' This is a demo of ViewPrint for PowerBASIC
- ' See ViewPrnt.Doc for details
- ' Copr. Barry Erick 1989, 1990
-
- COLOR 0,7
- origColor = SetVpatr(7,1)
- CLS
- ' Now fill the screen
- FOR y = 1 TO 25
- LOCATE y,3
- FOR x = 1 TO 7
- PRINT "PowerBASIC ";
- NEXT
- IF y < 24 THEN PRINT
-
- NEXT
- ' use the same attribute that the screen uses, grey on blue
- Vpatr = SETVPATR(7,0)
- ' now open a viewport. This also clears the window
- CALL ViewPrint(11,17)
- CALL ClsVpWind
- x = 1
- ' until a key is hit, print the line number within the view port
- DO UNTIL INSTAT
- IF x = 65 THEN
- flag = %false
- END IF
- IF x = 1 THEN
- flag = %True
- END IF
- IF Flag THEN
- INCR x
- ELSE
- DECR x
- END IF
- IF x = 0 THEN x = 1
- A$=SPACE$(79)
- MID$(a$,x)="Hit any key"+STR$(x)
- CALL Vprint(a$)
- LOOP
-
- 'throw away the key that was hit
- Dummy$ = INKEY$
-
- 'make a empty line for us to use
- CALL Vprintck
-
- 'and indent to position 2 on that line
- CALL VpLocate(-1,2)
- num = 18754.34
-
- 'and use a normal PB command or two
- PRINT "A formatted"," number is ";
- PRINT USING "#########.##";num
-
- 'now get to the next line by checking if a scroll is needed
- CALL VprintCk
-
- 'and indent to column 2 again
- CALL VpLocate (-1,2)
-
- ' and use a normal PB command again
- INPUT "What is your name";na$
-
- 'and check the next line
- CALL Vprintck
-
- 'and indent again (VPLoate is not needed if we don't indent)
- CALL VpLocate(-1,2)
-
- 'Again, use a PB command
- PRINT "Hello ";na$;
-
- 'and allow the screen to stay active awhile so we can see it if in the IDE
- DELAY 1.24
-
- CLS
-
- $LINK "Vp1.Pbu"
-