>>>>>>>What's the proper way to release an object? For example, if I :
>>>>>>>x=Createobject('myobject') where myobject is a class based on the
>>>>>>>cutom class (and thus, has no Release method built in)? x.Destroy()
>>>>>>>doesn't work since destroy is an even. I hate using Release x.
>>>>>>
>>>>>>why? if you're going to create in code, it makes sense (and easy reading) to release in code.
>>>>>
>>>>>I am releasing in code. I would like to have a method in my class that
>>>>>releases itself, however. So I could have the following easily readable code:
>>>>>
>>>>>o = Createobject('myobject')
>>>>>o.Show()
>>>>>o.This()
>>>>>o.That()
>>>>>o.TheOther()
>>>>>o.Release()
>>>>>
>>>>>
>>>>>Instead, I'm forced to change the last line to:
>>>>>
>>>>>"Release o", which I think is ugly.
>>>>
>>>>Why don't you put the "RELEASE o" in a user defined Release method?
>>>>
>>>>Vlad
>>>
>>>Tried. Doesn't work. I made a release method that did a "Release this", but it
>>>did nothing.
>>
>>Something is wrong. It should work. What do you mean by "it did nothing"? Can you still use the object? Do you still have the variable that keeps the reference to the object?
>>
>>Vlad
>
>Here is what I did:
>
>otest = CreateObject('test')
>? Type('otest') (returns O)
>otest.Release() (in the release method for otest, which i created, I have one line, "release this")
>? Type('otest') (_still_returns O)
>
>Thus, the "release this" in otest.Release() isn't releasing the object. Any ideas?
>
>oTest is based on a custom class.
I see Nick already gave you the answer. The correct test is
(TYPE('otest') = 'O') AND (NOT ISNULL(otest))
or simplier (but equivalent):
TYPE('otest.name') = 'C' && Any object has a Name property
Although, the first test version is clearer.
Vlad
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only