Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Some Basic Questions
Message
From
12/06/2004 20:30:22
Emmanuel Huybrechts
Technimeca International Corp.
Montréal, Quebec, Canada
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00912973
Message ID:
00913147
Views:
20
>Emmanuel,
>
>>>Q.No.2, What is difference between Nodefault and Dodefult?
>>
>>DODEFAULT() call the method of the base class, NODEFAULT prevents the method of the base class to run
>
>A slight correction.
>
>dodefault() calls up to the ParentClass method, which won't be the base class if you are more than one inheritance level deep in a class hierarchy.

Thanks for clearing this up. I'm influenced by the C# terminology where base class is the parent class.

>Tariq -
>
>In general you always want to call dodefault() so that the code you are inheriting will execute. Whether you call dodefault() at the beginning or end or somewhere in the middle of you code depends on how your code is extending the functionality of the class.
>
>Here's an example and a little more info about nodefault as well.
>
>For VFP events there is code in the VF baseclass itself that handles the event, this code always runs after all of the code that you might have added to the method. Calling nodefault will pervent this baseclass behavior from executing. For example you might want to handle some special keypresses inside a textbox control. Say you have a date bound textbox, if you press the M key you will hear a beep because of the default behavior in the textbox.keypress code. But you want to make the M key mean set the value to the first day of the month.
>
>
*txtDate.keyPress
>lparameter nKeyCode, shiftctrlalt
>
>do case
>   case inlist( nKeyCode, 77, 109 ) && M and m
>      * goto the first day of the month
>      this.Value = date( year( this.Value ), month( this.Value ), 1 )
>      nodefault && prevent the beep
>endcase
>
Previous
Reply
Map
View

Click here to load this message in the networking platform