CLS

From Liberty BASIC Family
Jump to navigation Jump to search
Supported in Just BASIC Supported in Liberty BASIC Not supported in Liberty BASIC 5 Supported in Run BASIC

MainWin Command

Description

This command clears the contents of the mainwin.

Syntax

  1. CLS

Example

Print "This text will be erased with the cls command,"
Print "you will not see it."
Print
Print "If you like to see it vanish,"
Print "step through the code using the debugger."
CLS

Text Editor Method

Description

This command clears the contents of the text editor control or window.

Syntax

Text Editor Control

  1. PRINT #Handle.Extension, "!CLS"
  2. #Handle.Extension "!CLS"

Text Editor Window

  1. PRINT #Handle, "!CLS"
  2. #Handle "!CLS"

Hints

  1. "!CLS" command resets the modified flag to false

Example

Text Editor Control

NOMAINWIN

TEXTEDITOR #m.te, 10, 10, 200, 200
OPEN "CLS - Test" FOR window AS #m
#m "trapclose [quit]"

#m.te "This will be cleared in 2 seconds"

' start waiting two seconds
TIMER 2000, [continue]
WAIT
[continue]
TIMER 0
' pause finished

#m.te "!CLS"

WAIT

[quit]
CLOSE #m
END

Text Editor Window

NOMAINWIN

OPEN "CLS - Test" FOR text AS #m
#m "!trapclose [quit]"

#m "This will be cleared in 2 seconds"

' start waiting two seconds
TIMER 2000, [continue]
WAIT
[continue]
TIMER 0
' pause finished

#m "!CLS"

WAIT

[quit]
CLOSE #m
END

Graphics Method

Description

This command clears the contents of the graphics control or window.
In addition, it frees all the used memory of the graphics control or window.
Only graphic commands after last CLS will "stick" after "FLUSH" command.

Syntax

Graphics Box

  1. PRINT #Handle.Extension, "CLS"
  2. #Handle.Extension "CLS"

Graphics Window

  1. PRINT #Handle, "CLS"
  2. #Handle "CLS"

Hints

  1. "Flush" remembers graphic commands after last CLS.
If you changed pen size or color, did CLS, then draw and FLUSH, state of pen before CLS is not remebered.
So your picture could change.

Example

Graphicbox Control

NOMAINWIN

GRAPHICBOX #m.gbx, 10, 10, 240, 200
OPEN "CLS - Test" FOR window AS #m
#m "trapclose [quit]"
#m.gbx "DOWN"
#m.gbx "\\This will be cleared in 2 seconds"
#m.gbx "flush"

' start waiting two seconds
TIMER 2000, [continue]
WAIT
[continue]
TIMER 0
' pause finished

#m.gbx "CLS"

WAIT

[quit]
CLOSE #m
END

Graphics Window

NOMAINWIN

OPEN "CLS - Test" FOR graphics AS #m
#m "trapclose [quit]"
#m "DOWN"
#m "\\This will be cleared in 2 seconds"
#m "flush"

' start waiting two seconds
TIMER 2000, [continue]
WAIT
[continue]
TIMER 0
' pause finished

#m "CLS"

WAIT

[quit]
CLOSE #m
END