Hi all,
I have a custom made class "myClass" which contains a function which will show a search form or close it if the search form is already open:
My main form uses the class in the following manner (Form's Init method):
Whenever a user hits the 'search' button on the main form I issue
If the search form is open it will be closed and vice versa.
What I want is: when the user closes the main form I want to close search form (that is, if it is open).
In my main form I do the following in its Destroy event:
I put a Destroy procedure in myClass which should handle this:
And here's where my problem occurs: the myClass.Destroy event is only called if the search form is already released OR if I close the VFP7 environment! So it seems to me that, if an object still holds any references, its Destroy won't be called untill all references are gone.
Is this normal behaviour? Or am I missing a point here?
I have a custom made class "myClass" which contains a function which will show a search form or close it if the search form is already open:
Code:
PROCEDURE Search
IF VARTYPE(This.m_oSearchForm) = "O" THEN
This.m_oSearchForm.Release
ELSE
DO FORM ".\forms\search" WITH This NAME This.m_oSearchForm NOSHOW
This.m_oSearchForm.Show(0)
ENDIF
ENDPROC
My main form uses the class in the following manner (Form's Init method):
Code:
PUBLIC myObject
myObject = CREATEOBJECT("myClass")
Whenever a user hits the 'search' button on the main form I issue
Code:
myObject.Search
What I want is: when the user closes the main form I want to close search form (that is, if it is open).
In my main form I do the following in its Destroy event:
Code:
RELEASE myObject
I put a Destroy procedure in myClass which should handle this:
Code:
PROCEDURE Destroy
*** If search form is still open, close it.
IF VARTYPE(This.m_oSearchForm) = "O" THEN
This.m_oSearchForm.Release
ENDIF
ENDPROC
Is this normal behaviour? Or am I missing a point here?