Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dangling Object Reference Question
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00810002
Message ID:
00812207
Views:
15
Simon,

Here's a copy of a message I posted over on the newsgroup that has bearing on your problem.

Setting values to dynamic expressions on the property sheet does not truly work because of the way class definitions are cached by VFP. For example:
create classlib inittest
create class setdeleted of inittest as custom
* on the property sheet make the expression for Tag: = set( "deleted" )
* close the class designer
set classlib to inittest
activate window "debug output"
debugout set( "deleted" ) && ON
o1 = createobject( "setdeleted" )
debugout o1.Tag && ON
set deleted off
o2 = createobject( "setdeleted" )
debugout o2.Tag && still ON
The reason for this is assignments made to properties on the property sheet are calculated only the FIRST time an object of that class is instantiated. Every other instance of the class gets the same value as the first instance. VFP has always worked like this.

If you instead make the Init() method:

this.Tag = set( "deleted" )

your each object will reflect value in effect at the time it is instantiated.

>In the class designer I set the a property called oBizObj of a dialog window to:
>
>=Screen.ActiveForm.Controls(1).oBizObj
>
>So that when the dialog is displayed it will use the Business of Object of the calling form.
>
>However, when I close the dialog and then try to close the calling form, the calling form does not release despite the fact that I null the oBizObj property when I close the dialog window.
>
>If I set the oBizObj property to:
>
>Screen.ActiveForm.Controls(1).oBizObj
>
>and then use Eval(myDialog.oBizObj) everything works fine. Can anyone explain this? Is this somehow related to how VFP caches the class definitions?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform