Article ID: 155388 - View products that this article applies to.
This article was previously published under Q155388
This article has been archived. It is offered "as is" and will no longer be updated.
The CLEAR RESOURCES command, a new command for Visual FoxPro 5.0, does not appear to work. When Visual FoxPro displays a bitmap, picture, cursor, icon, or font resource, Visual FoxPro caches the resource to optimize performance. If you use a resource of the same name (for example, a different bitmap with the same name as the one already cached), Visual FoxPro does not reload the resource.
Therefore, clearing a resource file is 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 does not reload each new graphic unless the existing one has been cleared from memory using the CLEAR RESOURCES command.
This scenario occurs when a resource is in use when you issue the CLEAR RESOURCES command.
The CLEAR RESOURCES command acts only on resources that are not currently in use. In the following example, the "Toggle bitmap" button attempts to clear a resource that is in use. The click code for the "Update form" button saves the current value of the picture property, sets the picture property to "", clears the resource (which is no longer in use), and resets the picture property back to its original value. Note that the specific resource is cleared by name. Any remaining resources are not cleared. The resources must be cleared because of caching for performance reasons. You want to clear only the resource you want to update so that any others will still be in the cache.
This behavior is by design. CLEAR RESOURCES acts only on resources not currently in use.
Article ID: 155388 - Last Review: February 24, 2014 - Revision: 2.3