General information
Category:
Forms & Form designer
Hi Agustin.
>> There is a rule on where to use DODEFAULT and where not? <<
Use DODEFAULT() whenyou want to execute the code (if any) in the same method in the parent class unless the parent class is a VFP base class. VFP base class behavior automatically executes after any custom code in the method is executed.
To prevent the VFP base class behavior from being executed, use NODEFAULT.
IF you want the VFP base class behavior to execute beforethe custom code in you method, do not use DODEFAULT(). Use the scope resolution operator followed by a NODEFAULT like so:
TextBox::GotFocus()
*** My custom code here
NODEFAULT
The reason you need the scope resolution operator to execute the base class behavior is that DODEFAULT() only executes the code in the parent class. It does notexecute the VFP base class behavior unless the parent class is the base class.
There used to be a bug in VFP 5.0 that caused the base class behavior to be executed when a DODEFAULT() was issued in a method. This has the net effect causing the base class behavior to be executed twice: once because of the DODEFAULT() and once after the custom code. This bug was fixed in VFP 6.0 (and broke some code, too, when it was fixed).
Marcia
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only