Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DODEFAULT with parameters
Message
De
31/07/2001 18:26:48
 
 
À
31/07/2001 16:55:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00538014
Message ID:
00538079
Vues:
19
By "default classes" I'm assuming you mean VFP's native base classes.

As for the Error() event: just having any Error event code is going to swallow the error unless you handle it. Even if you DoDefault().
VFP's native error handler will only fire the event, it won't raise it.

For other events and methods of subclasses off the native VFP classes, you don't need to call DoDefault() unless it's right in the middle of the code you want to handle - if so, you would also need a NoDefault after it so the behavior doesn't occur twice: it always occurs after your custom code unless you have the NODEFAULT keyword in there.

KeyPress(): What's your code doing? You may need to use NODEFAULT to suppress the behavior you don't want, instead of trapping the behavior you do.
e.g. no digits allowed in a textbox (I know there's other ways to do this, but it's an easy example).
LPARAMETERS nKeyCode, nShiftAltCtrl
If IsDigit(Chr(nKeyCode))
  NoDefault
EndIf
>This is a dumb one but it is bugging me.
>
>Several methods in the default classes (which I have subclassed) use predefined methods that receive parameters. For example most Error methods receive nError, cMessage, nLine & the Keypress event gets nKeyCode, nShiftAltCtrl. I like to add capability to these methods and am having trouble calling the default code.
>
>In Error's case I have used DODEFAULT(nError,cMessage,nLine) to allow those errors I don't trap to be processed normally. But nothing seems to happen using this syntax. I have had to find some code from another component and paste it in instead of the dodefault.
>
>In Keypress again I added DODEFAULT(nKeyCode, nShiftAltCtrl). This caused the object to only be one character long and the value to contain only the last character typed. Again I programmed around it with custom code all the way.
>
>Obviously, I would prefer not to custom code everything if I can help it. It is ineffient and prone to unforseen errors.
>
>Anyone got some ideas on this obviously dumb question
>
>Thanks in advance
>
>Terry
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform