Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question on releasing object and setting to .NULL.
Message
De
15/05/2009 02:27:36
 
 
À
14/05/2009 18:19:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01399978
Message ID:
01400069
Vues:
70
Sorry, I read to fast. I read your line as "release o.o1' instead of o.o1.release(). Anyway, the proper way is
o=CREATEOBJECT("empty")
ADDPROPERTY(o, "o1", CREATEOBJECT("form"))
o.o1.release()
o.o1=.null.
release o.01
? TYPE("o.o1")  && Shows "U" as you want??
>>>
>But how do you execute o.o1.release() if you've set o.o1=.NULL. first?
>
>>You have the order wrong. First you set the property to NULL, then you release it.
>>
>>>Standard practice seems to be, to set an object's property to .NULL. after releasing an object tied to a property. For example:
>>>
>>>o=CREATEOBJECT("empty")
>>>ADDPROPERTY(o, "o1", CREATEOBJECT("form"))
>>>o.o1.release()
>>>o.o1=.null.
>>>? TYPE("o.o1")  && still shows "O"
>>>
>>>
>>>It seems it would be better to set the property to .F. instead, after releasing it. That way, anything that tests for TYPE("o.o1") = "O" would not be fooled. Setting the property to .NULL. still leaves the type as "O" (object). Whereas, setting the property to .F. changes the type to "L". Is there a good reason for using .null.? Which requires an additional test using ISNULL(). I often check using TYPE("..") = "O" because the property may not have been created and/or assigned. Thanks for any insight into reasons for using the .NULL. assignment.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform