bas7advr.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 Statement Details
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
The CLS statement clears various parts of the display screen.
 
CLS [{0 | 1 | 2}]
 
Usage Notes
    ■ The CLS statement can be used to:
        - Clear the entire screen (except the bottom line of text), the text
          viewport, or the graphics viewport
        - Regenerate the bottom line of text
        - Return the cursor to the home position (the upper-left
          corner of the screen).
    ■ The behavior of a particular CLS statement depends on:
        - The CLS statement argument: 0, 1, 2, or none.
        - The current screen mode.
        - Whether or not a VIEW statement has been executed which has
          changed the graphics viewport from the default of the entire
          screen.
        - Whether or not a VIEW PRINT statement has been executed which
          established a user-defined text viewport.
        - Whether or not a KEY ON statement has been executed, which
          established the bottom text line as a list of function-key
          assignments. The bottom line on the screen may be 25, 30, 43,
          or 60, depending upon the current screen mode.
    ■ The following fundamentals about the graphics and text viewports
      determine how the CLS statement works:
        - SCREEN mode 0 has only a text viewport. All other screen modes
          have both a text and graphics viewport.
        - The default graphics viewport is the entire screen.
        - The default text viewport is the entire screen, except for the
          bottom line of text.
        - After a user-defined graphics viewport (or "clipping region")
          has been established by execution of a VIEW statement, it is
          reset to the default by execution of any of these statements:
            VIEW without arguments;
            CLEAR;
            any SCREEN statement that changes the screen resolution.
        - After a user-defined text viewport has been established by
          execution of a VIEW PRINT statement, it is reset to the default
          by execution of any of these statements:
            VIEW PRINT without arguments,
            any text-oriented statement, such as WIDTH, that changes the
            number of text columns or text lines on the screen.
        - If the KEY ON statement has been executed, the CLS statement
          regenerates the bottom screen line as the function key assignment
          list or as a line of blank characters.
    ■ Following is a table that summarizes how the CLS statement works:
 
      Statement    Condition             Operations Performed
      ═════════    ════════════════════  ═══════════════════════════════════
      CLS 0        Any screen mode,      1. Clear entire screen of all text
                   any combination of       and graphics, except bottom text
                   user-defined             line.
                   viewports             2. Clear graphics viewport.
                                         3. Regenerate bottom text line.
                                         4. Return the cursor to home.
 
      CLS 1        Graphics screen mode  1. Clear default graphics viewport.
                   with no user-defined  2. Do not clear text viewport.
                   graphics viewport     3. Regenerate bottom text line.
                                         4. Return the cursor to home.
 
      CLS 1        Graphics screen mode  1. Clear user-defined graphics
                   with user-defined        viewport.
                   graphics viewport     2. Do not clear text viewport
                                         3. Do not regenerate bottom
                                            text line.
                                         4. Do not return the cursor to home.
 
      CLS 1        In SCREEN mode 0      Has no effect.
                   (text mode)
 
      CLS 2        Any screen mode       1. Clear the text viewport.
                                         2. Do not clear the graphics
                                            viewport.
                                         3. Do not regenerate the bottom
                                            text line.
                   Note: The bottom line of text will not be cleared
                         even if it is included in the user-defined
                         text viewport.
 
      CLS          Graphics-screen mode  1. Clear default graphics viewport.
                   with no user-defined  2. Regenerate bottom text line.
                                         3. Return the cursor to home.
 
      CLS          Graphics-screen mode  1. Clear user-defined graphics
                   with user-defined        viewport.
                   graphics viewport     2. Do not regenerate bottom text
                                            line.
                                         3. Do not return the cursor to home.
 
      CLS          In SCREEN mode 0      1. Clear text viewport.
                   (text mode)           2. Regenerate bottom text line.
                                         3. Return the cursor to home.