Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automatic Destroy method
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01246863
Message ID:
01246958
Views:
27
This message has been marked as a message which has helped to the initial question of the thread.
Hi Naomi,

>Do you think it's worth the trouble to make a generic Destroy method or it's better to continue the current practice of modifying each individual form's Destroy method?

You need generic code in the base classes, but there are some issues...

- It's not sufficient to remove all references within a form, you also need to clear all references in outside objects that point to objects on your form. For instance, you might have some global error validation object that keeps a reference to the control that caused the error. The rule is: There must not be any reference to any object on a form.

- Destroy is usually too late. It's much better than not doing anything at all, but you still might see crashes. The only stable solution is in my experience to clean references in the Release method before you issue DODEFAULT() and in the QueryUnload event when you allow unloading.

- Generic clean up code is difficult to do with arrays and collections. With arrays you only need to check looooots of elements. With collections you can have overridden access routines that don't allow numeric index access anymore.

- Before you attempt to access an o-property, you should check for a access method. Such properties might not store a property, but request objects from somewhere else. The same is true for assign methods.

- If you use classes from other developers make sure that your code can deal with varying visibilities, especially with hidden properties. Also, they might not use the same naming convention. So you might miss object references in this case.

- Check for ActiveX controls. They behave differently than other controls.
--
Christof
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform