Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need to nuke objects in Destroy?
Message
De
26/08/2009 11:59:04
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01405727
Message ID:
01420836
Vues:
107
>The objects that create such references should clean up after themselves in Destroy. Otherwise those objects cannot be released and form cannot be released as well.
>
>    Thisform.oGrid = NULL
>
>>I have a form in which I have saved references to some of the objects in the form -- the Init for these objects look like:
>>
>> Thisform.oGrid = This
>>
>>This allows me to reference the grid without knowing its full containership.
>>
>>So, my question is this: when the form is closing, there are all these references to objects contained in ThisForm. Do I need to clean them up, or is this not a problem?
>>
>>Thanks in advance.

I have a property on my form, which is an Object that has other Object properties on it. So, I'm wondering if I could create a generic methdod that would basically scan the entire passed-in object and set every property that begings with the letter 'o' to null.

Something like this:
Procedure Form.Destroy()
 
 this.DestroyObectRefProperties(this.oSomeObject)

EndProc
Some psuedo code here...
Procedure DestroyObjectRefProperties(toObject)

for each property on toObject
 if property.name begins with 'o'
  property = .null.
 endif
endfor

EndProc
So, how can you scan the over the properties like above, without having to know the property names?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform