Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

Clear

This simplest of the Clear commands erases a window or clears the main screen.

Usage

CLEAR

When you apply CLEAR to a form, the controls disappear but they’re not destroyed. The form’s Refresh method brings some of them back. Giving the form focus brings back some more. Clicking somewhere on the form brings back any controls at that location. Items drawn with the form’s drawing methods don’t come back (which is as it should be). In reality, CLEAR isn’t really meant for forms. Use RemoveObject to get rid of controls and Cls to erase drawing objects.

If you use the Picture property of _SCREEN to create a backdrop for your application, like the background-tiled images on the Web, you may find that after a while, the top quarter or fifth of the screen stops clearing correctly and starts accumulating bitmap garbage. Force the screen to clear with:

LOCAL llLockScreen, lcPicture
llLockScreen = _SCREEN.LockScreen
_Screen.LockScreen = .T.
lcPicture =_SCREEN.Picture
_SCREEN.Picture=""
_SCREEN.Picture =lcPicture
_Screen.LockScreen = llLockScreen

Example

ACTIVATE SCREEN
CLEAR

See Also

Cls, Refresh, RemoveObject