Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird thing about .Destroy
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00058959
Message ID:
00058961
Views:
24
>I have a nav button class which had some references to THISFORM.DataEnvironment. Of course, it was hosed when I dropped it into a form that was in a formset. So, I gave the navclass a property "oFormOrSet", and in a navclass method called from the .Init, I put this:
>
>
>* Figure out if it's a form or a formset,
>* set everything accordingly
>
>IF TYPE("THISFORMSET") = "O"
>	THIS.oFormOrSet = THISFORMSET
>ELSE
>	THIS.oFormOrSet = THISFORM
>ENDIF
>
>I used it to say things like .oFormOrSet.DataEnvironment. But when I needed it in the navclass.Destroy to clean up things in the DE, my reference was gone, even though THISFORMSET or THISFORM still existed. So I had to do something similar in the navclass.Destroy with a local variable:
>
>* the object reference THIS.oFormOrSet
>* seems to have been detroyed, even though
>* the form or formset still exists
>IF TYPE("THISFORMSET") = "O"
>	oFormThis = THISFORMSET
>ELSE
>	oFormThis = THISFORM
>ENDIF
>
>
>and then used it to say oFormThis.DataEnvironment. Is it really supposed to be this way?

Personally, I would prefer to use Parent property to reach DE at the code point when it's really necessary (using TYPE(), of course). I try to abstain from using object reference variables/properties, just because it smells like invitation to troubles...
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform