Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
User defined methods pre-empt necessary processing?
Message
 
 
To
17/07/1999 00:31:14
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00242642
Message ID:
00242724
Views:
26
David,

>From what I gather, it is a good idea, in general, to DODefault() in subclass methods that override inherited code, because generally speaking, one would be adding functionality to a special subclass. (btw, I wasn't overriding to prevent inherited behavior...just wasn't sure if my overriding was in fact preventing inherited behavior).

Whenever you put code in a method or change a property on the property sheet you are overriding. This is also called programming by exception.

>Now if what Jim says is true, the DODEFAULT() is not really necessary for methods inherited directly from VFP baseclasses because it will always be executed anyway...??? ... but putting it in, as part of 'good' general practice is a good idea??

Right, none of my first level classes, those derived directly from a VFP BaseClass, issue a dodefault(). If you are deriving from the FFC classes then your first level should issue dodefault() because the FFC subclass layer is between you and the VFP BaseClasses.

>You also say I may explicitly execute the DODEFAULT() anywhere in the modified method ... so I presume this let's me control when the 'default behavior' occurs?

Not exactly. You have "default behavior" for the VFP BaseClass. You could also say the "default behavior" for your subclass. DoDefault() calls your overridden method code higher up the class tree. DoDefault() and ParentClass::Method() are the only ways that your method code higher up the tree will execute. The VFP BaseClass default behavior will always occur after your code unless you use NODEFAULT to prevent it.

>Is the default behavior for inherited baseclass methods explicitly specified anywhere in the official documentation?

No it isn't really documented anywhere. There are only a handful of places where you really care. The only place it's relevant is for Events. For example a CommandButton MouseDown event occurs when the user pushes the mouse button while over button. The default behavior for this event is to change the appearance of the button to make it look pressed. If you put a NODEFAULT in that method you would prevent this from happening. You don't have to ever explicitly call it though it'll happen automatically. If you put a NODEFAULT in the MouseUp you will prevent the Click event from occuring. Putting NODEFAULT in the Click method accomplishes nothing, because the VFP BaseClass doesn't do anything. Try it for yourself, drop three BaseClass CommandButtons on a form, put and see how nodefault affects each method. Turn on EventLogging in the debugger to help watch the sequence of events. Also drop three instances of your button class that has some kind of code in it's click, like just a ? chr(7).

>Like the old 'Outer Limits' show...I want to be the one who controls the Horizontal and the Vertical. That means I need full access to the information of how to control it. Doesn't seem like too much to ask of a professional developers tool.

It's only an illusion if you ever think you are in control of these computers. *L*
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