Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Some Basic Questions
Message
De
12/06/2004 20:30:22
Emmanuel Huybrechts
Technimeca International Corp.
Montréal, Québec, Canada
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00912973
Message ID:
00913147
Vues:
19
>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
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform