Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to always execute subclass method code
Message
From
02/11/1997 13:01:36
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00057866
Message ID:
00057868
Views:
26
>In my first subclass of a base class, can I always execute the method code there ?
>Let's say in a grid, I have my Init event code, that must be executed. When another developer places code in the Init event of the subclassed object, they must use dodefault() or my code is not executed. Is there a way to force my code to be executed, unless a NODEFAULT is placed in the object ?

Yes, one method that I use is like this. It mostly consists of using hooks.

In a situation like this, when you want to avoid having to remember to put DODEFAULT(), using hooks may do the job.

1. In your object, create a method like OurInit()
2. In your object Init(), in the appropriate place, call This.OurInit()
3. In your form, if init code should be handled, place it in OurInit()
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform