advr.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
  ◄Summary►  ◄Details►  ◄Example►                ◄Contents►  ◄Index►  ◄Back►
──────────────────────────────────────────────────────────────────────────────
 CLS [0 | 1 | 2]
 
 Usage Notes
   ■ If no object is specified, CLS behavior is determined by its location
     in code:
     • If CLS is used in a form module, it is a method, and applies to the
       default form. See: ◄CLS Method►
     • If CLS is in a non-form or code module, it is a statement, and applies
       to the entire screen.
 
   ■ If CLS is used as a statement (with the arguments 0, 1, or 2) when forms
     are showing, Visual Basic generates the error message, "Invalid
     when forms are showing."
 
   ■ To use the CLS statement with arguments 0, 1, or 2, you must first
     unload or hide any visible forms.
     See: ◄HIDE Method►  ◄UNLOAD Statement►
 
   ■ 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 that has changed the
       graphics viewport from the default of the entire screen.
     • Whether or not a VIEW PRINT statement has been executed that has
       established a user-defined text viewport.
     • Whether or not a KEY ON statement has been executed that has
       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 on the current screen mode.
 
   ■ The following conditions determine how the CLS statement works with
     graphics and text viewports:
     • 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 executing a VIEW statement, it is reset to the default
       by executing any of the following statements:
       ■ VIEW without arguments
       ■ CLEAR
       ■ Any SCREEN statement that changes the screen resolution
     See: ◄CLEAR Statement►  ◄SCREEN Statement►  ◄VIEW Statement►
 
     • After a user-defined text viewport has been established by executing
       a VIEW PRINT statement, it is reset to the default by executing any of
       the following 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
     See: ◄VIEW PRINT Statement►  ◄WIDTH Statement►
 
     • If the KEY ON statement has been executed, CLS statement regenerates
       the bottom screen line as the function-key assignment list or as a
       line of blank characters.
     See: ◄KEY Statement (Assignment)►
 
   ■ The following table summarizes how the CLS statement works:
 
     Statement    Condition               Operations Performed
     ═════════    ════════════════════    ══════════════════════════════════
     CLS 0        Any screen mode or      • Clears entire screen of all text
                  combination of user-      and graphics except bottom text
                  defined viewports         line
                                          • Clears graphics viewport
                                          • Regenerates bottom text line
                                          • Returns cursor to home
 
     CLS 1        Graphics screen mode    • Clears default graphics viewport
                  with no user-defined    • Does not clear text viewport
                  graphics viewport       • Regenerates bottom text line
                                          • Returns cursor to home
 
     CLS 1        Graphics screen mode    • Clears user-defined graphics
                  with user-defined         viewport
                  graphics viewport       • Does not clear text viewport
                                          • Does not regenerate bottom text
                                            line
                                          • Does not return cursor to home
 
     CLS 1        In screen mode 0        No effect
                  (text mode)
 
     CLS 2        Any screen mode         • Clears text viewport
                                          • Does not clear graphics viewport
                                          • Does not regenerate bottom text
                                            line
                                          Note: The bottom line of text will
                                          not be cleared even if included in
                                          the user-defined text viewport.
 
      CLS         Graphics-screen mode    • Clears default graphics viewport
                  with no user-defined    • Regenerates bottom text line
                  graphics viewport       • Returns cursor to home
 
      CLS         Graphics-screen mode    • Clears graphics viewport
                  with user-defined       • Does not regenerate bottom text
                  graphics viewport         line
                                          • Does not return cursor to home
 
      CLS         In Screen mode 0        • Clears text viewport
                  (text mode)             • Regenerates bottom text line
                                          • Returns cursor to home