Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What, really, is NODEFAULT?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00028566
Message ID:
00028635
Vues:
48
OK, there are two types of spots that we can put our own code into and
object: methods and events. Our event code gets executed when some event
occurs. This event may be a users click, a timer event, an event
triggered by code... The method code is executed when a method is
called. In both cases VFP has some base class functionality and in
both cases the code in the snippet is executed before any base
functionality.

Take a text box, for example. When the user types
an 'e' in the text box, the base class functionality of the key press
event causes an 'e' to appear in the box. This is not overridden by
any snippet code. When the refresh is called, the snippet code is run
and then the box is redrawn on the form. If your snippet code overrode
the base class, then you would have to figure out some way to tell
Windows to paint a text-box on your form.

When we speak of inheritance in a language like VFP, we are talking about
our code not the base class functionality. Luckily, however, there is a
way to stop the base class functionality in most events & methods, NODEFAULT.

There is also a function DODEFALUT() which is NOT the oppisite of
NODEFAULT as it may appear. DODEFAULT runs the parent class snippet code
that WAS overridden by your code in the event or method.

Good Luck,
Geary


>Matt,
>
>That may be it! In which case either the definition of 'inheritance' is inaccurate in the docs, or I have badly misread it. 'Cause I sure thought it said that sub-class method code executes IN PLACE OF Class method code when there is some.
>
>IF we assume this latest idea to be the answer, then it would be darmned nice if the VFP docs told us explicitly which behaviours are subject to NODEFAULT and which are overridden by inheritance.
>
>Cheers,
>Jim N
>
> >I have a thought.
>>
>>If I'm to understand Ed and Geary correctly:
>>
>>Any code will stop inheritance of code defined in a class, but NODEFAULT
>>is needed to stop code inherited by the BaseClass. (the code you never
>>see in the trace window)
>>
>>Did Ed already say that? I think he did.
>>
>>Matt
Geary Eppley - geary@hosports.com
H.O. Sports, Inc. - Redmond, WA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform