Knowledge Base

PRB: Object that Received the Destroy Not Released

Article ID: 127844

Article Last Modified on 2/12/2000


APPLIES TO


This article was previously published under Q127844

SYMPTOMS

Calling the Destroy() function under program control to release an object does not work. The object is still there and its methods can perform tasks. This behavior is particularly visible with a form that receives the Destroy() because the form window is not deactivated.

CAUSE

When Destroy() is explicitly called under program control, the method associated with the event is executed. However, calling the method does not trigger the event. To release a form, you must release the instance variable referencing the form object. The variable is released when it goes out of scope or when the RELEASE command is issued.

STATUS

This behavior is by design.

MORE INFORMATION

In the Visual FoxPro event model, calling a method associated with an event will not trigger the event. The method can be executed as a response to an event or as a response to an explicit call (such as Thisform.Click()). To trigger the CLICK, DBLCLICK, MOUSEDOWN, MOUSEMOVE, or MOUSEUP events, use the MOUSE command. The ERROR event can be triggered by the ERROR command. For a list of events that Microsoft Visual FoxPro objects respond to, search for Events under the Language Reference topic in Visual FoxPro Help.

Additional query words: VFoxWin

Keywords: KB127844