CLEAR Commands
Releases the specified item or items from memory.
CLEAR [ALL | CLASS ClassName | CLASSLIB ClassLibraryName | DEBUG | DLLS
[cAliasNameList]| EVENTS | FIELDS | GETS | MACROS | MEMORY
| MENUS | POPUPS | PROGRAM | PROMPT | READ [ALL] | RESOURCES
[FileName] | TYPEAHEAD | WINDOWS]
Parameters
ALL
Releases from memory all variables and arrays and the definitions of all user-defined menu bars, menus, and windows. CLOSE ALL also closes any tables, including all associated index, format and memo files, and selects work area 1. CLEAR ALL also releases from memory all external shared library functions registered with DECLARE - DLL.CLEAR ALL does not release system variables, and does not clear the compiled program buffer. Use CLEAR PROGRAM to clear the compiled program buffer.
Issuing CLEAR ALL within an event or method for an active control or object generates a Visual FoxPro error message. An object type variable cannot be released from memory when its associated control or object is active.
CLASS ClassName
Clears a class definition from memory. When an instance of a class is created, Visual FoxPro keeps the class definition in memory after the instance is released. Use CLEAR CLASS to clear a class definition from memory after its instance is released.CLASSLIB ClassLibraryName
Clears from memory all class definitions contained in a visual class library. If instances of classes in the class library exist, the class definitions are not cleared from memory. However, all class definitions that do not have instances are cleared from memory.DEBUG
Clears all breakpoints in the Debugger and restores the Debugger windows (Call Stack, Trace, Watch, etc.) to their default positions.If Clear Debug is issued when the Debugger is closed, the Debugger is opened with the Debugger windows in their default positions.
Works in either fox or debugger frame mode.
DLLS cAliasNameList
Clears from memory external shared libraries registered with DECLARE - DLL. cAliasNameList is a comma separated list of function aliases to remove from memory as in the following example:CLEAR DLLS "RegCloseKey","RegOpenKey"
If you used no alias in the declaration, cAliasNameList is the same as the function name. If you specify no cAliasNameList, all DLLS are removed from memory. You can use the ADLLS( ) Function to determine which DLLs are loaded.
See DECLARE - DLL Command for more information about registering external shared library functions.
EVENTS
Stops event processing started with READ EVENTS. When CLEAR EVENTS is executed, program execution continues on the program line immediately following READ EVENTS.FIELDS
Releases a list created with SET FIELDS and executes SET FIELDS OFF. CLEAR FIELDS differs from SET FIELDS TO in that it releases all field lists for all work areas, not just the field list for the current work area. Also, SET FIELDS TO does not implicitly issue a SET FIELDS OFF.GETS
Releases all pending @ ... GET controls. Issuing CLEAR also releases all pending @ ... GET controls.Note GETS is included for backward compatibility.
MACROS
Releases from memory all keyboard macros, including any SET FUNCTION key assignments. Macros can be saved to a macro file or to a memo field with SAVE MACROS and restored later with RESTORE MACROS. You can also restore the default macros with RESTORE MACROS.MEMORY
Releases from memory all public and private memory variables and arrays. System variables aren't released.MENUS
Releases all menu bar definitions from memory.POPUPS
Releases from memory all menu definitions created with DEFINE POPUP.PROGRAM
Clears the compiled program buffer. Visual FoxPro keeps a buffer of the most recently executed programs. In rare cases, Visual FoxPro might not recognize changes made to program files on disk. CLEAR PROGRAM forces Visual FoxPro to read the programs from disk, rather than from the program buffer. The most common reason Visual FoxPro might not recognize changes made to program files is your using an external or terminate-and-stay-resident (TSR) editor to modify a program file. With this exception, you should not have to use CLEAR PROGRAM.PROMPT
Releases menu items created with @ ... PROMPT.READ [ALL]
Included for backward compatibility. Use CLEAR EVENTS instead.RESOURCES [FileName]
Specifies the name of a cached bitmap, picture, font, cursor, or icon file to be cleared from memory. If no file name is specified, all bitmap, picture, font, cursor and icon files are removed from memory.When Visual FoxPro displays a bitmap, picture, cursor, icon, or font resource, the resource is cached to optimized performance. If a resource of the same name is used (for example, a different bitmap with the same name as one already cached), Visual FoxPro does not reload the resource.
Clearing a resource file is therefore particularly useful for removing a graphic image from memory and forcing Visual FoxPro to reload an image of the same name from disk. For example, a report might display graphic images from a database, all of which are named TEMP; however, because they all have the same name, Visual FoxPro will not reload each new graphic unless the existing one has been cleared from memory using the CLEAR RESOURCES command.
TYPEAHEAD
Clears the keyboard type-ahead buffer. CLEAR TYPEAHEAD is useful when you want to prevent input into a field or prevent a response to a prompt before the field or prompt is displayed.WINDOWS
Releases from memory all user-defined window definitions and clears the windows from the main Visual FoxPro window or the active user-defined window. Use SAVE WINDOW to save window definitions in a file or memo field for later use.Issuing CLEAR WINDOWS releases any system variable references to forms. For example, the following commands create a system variable reference for a form, and then display information about the variable:
goMyForm = CREATEOBJECT('FORM') DISPLAY MEMORY LIKE goMyForm && Displays GOMYFORM O FORM
Issuing CLEAR WINDOWS releases the system variable reference and the variable now contains the null value:
CLEAR WINDOWS DISPLAY MEMORY LIKE goMyForm && Displays GOMYFORM O .NULL.
Remarks
CLEAR erases the main Visual FoxPro window or the current user-defined window, and releases from memory all pending @ ... GET controls. You can include CLEAR in format files.
See Also
@ ... CLEAR | CLOSE | DECLARE -DLL | READ | READ EVENTS | RELEASE | RELEASE CLASSLIB | RELEASE WINDOWS