Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why doesn't the container's Destroy method fire?
Message
De
11/07/2000 14:53:42
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00390808
Message ID:
00390887
Vues:
8
Hi Rich,
There are objects that, because of other references, just can't release by themselves. You may have one. Even if you don't here you will at some point. I handle this by having the Form ALWAYS call it's DumpGarbage() in the Release. (This means that the QueryUnload may call the release, if the Release didn't call it since I want the Release to always run.)
Each object that has Garbage Collection issue knows it and, by convention, has a DumpGarbage method. That method knows what to do to handle the garbage. When the object it intaniated, it registers with the Form like this:
IF PEMSTATUS(Thisform,'HaveGarbage',5)
   ThisForm.HaveGarbage(This)  && Yep, I have garbage.
ENDIF
The HaveGarbage method for the form holds the objects that have garbage in an array. When the Form's DumpGarbage is called, it cycles through the objects and calls their DumpGarbage methods.
I think most folks will need this type of feature in their forms eventially.

Charlie


>I have a container control that has in it's Destroy method a call to an object that has a reference to it. When the Form is closed I thought the Destroy method of the container would fire before the form's Destroy. The container object has the following in the Destroy.
>
>oObject.Detach(nUniqueID)
>DODEFAULT()
>
>The Detach method of the oObject then looks up the objects reference using the nUniqueID and then sets it's Object reference to NULL. However, the Destroy code never fires. I even put a WAIT WIND in to see if it fired and it didn't. In the Form's Destroy I can put in the code of THISFORM.oContainer.Detach(nUniqueID) and all works fine. I am trying to write this container control to be able to be dropped onto the form and manage itself.
>
>I wonder if I could instantiate a Timer to release the object?
>
>Any ideas?
Charlie
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform