Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Button calls a form, form returns values, button code co
Message
From
29/08/2008 13:28:09
 
 
To
29/08/2008 10:03:40
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01342942
Message ID:
01343224
Views:
21
>>>>Hi Jay,
>>>>
>>>> How can I keep the other values gathered from Form2 in scope, or return them to Form1?
>>>>
>>>>Store them into properties of the form. Then, in the Unload event create an object based on the EMPTY() class and use ADDPROPERTY() to transfer all values to the object. Return this object or NULL instead of .T. and .F.
>>>
>>>A coworker also questioned this method due to possible memory leaks on the created object.
>>
>>Why would there be memory leaks? You have code like this:
>>
>>
>>LOCAL oReturn
>>
>>DO FORM Form2 TO m.oReturn
>>
>>* Do stuff with the return value
>>
>>RETURN
>>
>>
>>When the method ends, the object is released.
>>
>>Tamar
>
>What about the object created in the called form? When the RETURN is issued with that object sent to the calling form, it has not been released.

No, but that reference to it is, and the reference counter is decremented, so that when the other reference is released, the object is destroyed.

Easy enough to test by create a little class with a DEBUGOUT in the Destroy event.

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform