ex.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 Statement 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 to clear the text viewport after
' "Hello" has been printed 45 times.
 
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
 
 CLS                               ' Clear the screen
 RANDOMIZE TIMER
 SCREEN 1
 VIEW (5, 5)-(100, 80), 3, 1       ' Set up a graphics viewport with a border
 VIEW PRINT 12 TO 24               ' Set up a text viewport
                                   ' 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
                                   ' circles
     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$ <> ""
 WIDTH 80
 SCREEN 0