Hi.
I have a simple problem
Here's my procedure :

PROCEDURE DestroyMyObject
PARAMETERS TheObject
RELEASE TheObject
ENDPROC

I tried to call it with @ but it has no effect.
How can I release my parameters in a procedure ? Is it
possible ?
Thanks in advance for your help.

Re: Release object in a procedure by Gerben

Gerben
Wed Jun 23 07:11:23 CDT 2004

The way you try it, it's not posible because you get a reference or value in
a new variable.
With the RELEASE you release that new variable and not the original.

The variable your release must be in scope, so make it a private (or public)
var.

*Code:
ox = CREATEOBJECT("demo")

DEFINE CLASS demo AS Session

PROCEDURE Init

private poObject
poObject = CREATEOBJECT("label")

this.destroymy()

*- this fails now...
WAIT WINDOW poObject.caption

ENDPROC

PROCEDURE destroymy()

RELEASE poObject

ENDPROC

ENDDEFINE
* End

hth,

Gerben Kessen






"crampe" <belenos555@yahoo.no> wrote in message
news:204f801c45918$ccfc9910$a401280a@phx.gbl...
> Hi.
> I have a simple problem
> Here's my procedure :
>
> PROCEDURE DestroyMyObject
> PARAMETERS TheObject
> RELEASE TheObject
> ENDPROC
>
> I tried to call it with @ but it has no effect.
> How can I release my parameters in a procedure ? Is it
> possible ?
> Thanks in advance for your help.
>



Re: Release object in a procedure by Crampe

Crampe
Wed Jun 23 07:41:24 CDT 2004

Ok.
This is not exactly what I wanted but it helped me to find
a solution.
Thank you.

>-----Original Message-----
>The way you try it, it's not posible because you get a
reference or value in
>a new variable.
>With the RELEASE you release that new variable and not
the original.
>
>The variable your release must be in scope, so make it a
private (or public)
>var.
>
>*Code:
>ox = CREATEOBJECT("demo")
>
>DEFINE CLASS demo AS Session
>
>PROCEDURE Init
>
> private poObject
> poObject = CREATEOBJECT("label")
>
> this.destroymy()
>
> *- this fails now...
> WAIT WINDOW poObject.caption
>
>ENDPROC
>
>PROCEDURE destroymy()
>
> RELEASE poObject
>
>ENDPROC
>
>ENDDEFINE
>* End
>
>hth,
>
>Gerben Kessen
>
>
>
>
>
>
>"crampe" <belenos555@yahoo.no> wrote in message
>news:204f801c45918$ccfc9910$a401280a@phx.gbl...
>> Hi.
>> I have a simple problem
>> Here's my procedure :
>>
>> PROCEDURE DestroyMyObject
>> PARAMETERS TheObject
>> RELEASE TheObject
>> ENDPROC
>>
>> I tried to call it with @ but it has no effect.
>> How can I release my parameters in a procedure ? Is it
>> possible ?
>> Thanks in advance for your help.
>>
>
>
>.
>

Re: Release object in a procedure by Holger

Holger
Thu Jun 24 02:41:01 CDT 2004

Hi,

> PROCEDURE DestroyMyObject
> PARAMETERS TheObject
> RELEASE TheObject
> ENDPROC
>
> I tried to call it with @ but it has no effect.
> How can I release my parameters in a procedure ? Is it
> possible ?

I ask myself, why someone should do that ?

If you want to delete an object, that exists in a containership, you can use
the REMOVEOBJECT() method of that container. Each container class provides
that method.

If you want to delete an object, whose reference is in a variable, just set
the variable to .null. !

--
Holger Vorberg
MS Visual FoxPro MVP, Germany