bas7ex.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CLS and VIEW PRINT Statements Programming Example
                       Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
'This example uses the VIEW PRINT statement to set up graphics and text
'viewports.  The CLS statement is used to clear the graphics viewport
'after 30 circles have been drawn and the text viewport after "Hello"
'has been printed 45 times.
 
RANDOMIZE TIMER
SCREEN 1
'Set up a graphics viewport with a border.
VIEW (5,5)-(100,80),3,1
'Set up a text viewport.
VIEW PRINT 12 TO 24
'Print a message on the screen outside the text viewport.
LOCATE 25,1 : PRINT "Press any key to stop."
Count=0
DO
   'Draw a circle with a random radius.
   CIRCLE (50,40),INT((35-4)*RND+5),(Count MOD 4)
   'Clear the graphics viewport every 30 times.
   IF (Count MOD 30)=0 THEN CLS 1
   PRINT "Hello. ";
   'Clear the text viewport every 45 times.
   IF (Count MOD 45)=0 THEN CLS 2
   Count=Count+1
LOOP UNTIL INKEY$ <> ""