Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Releasing objects added to the screen
Message
De
06/02/2012 07:09:39
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01534450
Message ID:
01534513
Vues:
79
>>>>>>I have created an object that I place on the screen... ie I use _screen.addobject
>>>>>>How do I get the object to release. I know clear all works, but that is kind of drastic, don't you think?
>>>>>>
>>>>>Setting the object to null will release it
>>>>
>>>>You can't set a control hosted on a form (in this case _screen) to .null., you must use the .RemoveObject() method.
>>>
>>>Oops !, I thought setting an object to null *released* it - haven't used Fox for a while now so am a bit rusty. If the object in question was a non visual one ( I.e not a control ) would my suggestion work then ? Thanks for correcting me.
>>
>>Pete,
>>
>>Visual or not visual is not the issue
>>
>>If you use AddObject(), you have to use RemoveObject() since the object is part of a collection, eg thisform.Controls()
>>
>>If you use CreateObject() and then assign that reference to a property of another object, setting the property back to null will release the object - provided it is not referenced anywhere else
>>
>>eg
>>
>>=_screen.AddProperty('txt', createobject('TextBox'))
>>?_screen.txt.name && Text
>>_screen.txt = null  && releases the object
>>
>
>Hi Gregory, thanks for that - I was getting confused between AddProperty() and AddObject() - as I said earlier I've been away from Fox for a while now and I probably shouldn't have answered the thread :-( thanks again for your time.


You're welcome to answer anytime, Pete
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform