Wiki Home

DODEFAULT


Namespace: VB
Dodefault() and the operator composed of two colons ("::" called the "Scope Resolution") let you call methods higher up in the class hierarchy.

It also lets you execute any VFP behavior associated with the method or event its issued in. For example, doing a DODEFAULT() in the Show() method, shows the form, or DODEFAULT() in the Key Press() event simulates a key being pressed. This only works if there if the code is put in an instance of a VFP base class or a direct subclass of the VFP base classes. -- Mike Helland

Hmm, thats nutty. In a textbox.keypress:
DODEFAULT( nKeyCode, nShiftAltCtrl)
DODEFAULT( nKeyCode, nShiftAltCtrl)
and I get 3 letters for each key. Adding a NODEFAULT and I still get 2. -- ?CFK

That's because DODEFAULT() in an event method is slightly different than DODEFAULT() in a method. Some behaviors (such as Key Press) happen even if you don't call DODEFAULT(). You need to affirmatively NODEFAULT them to suppress them. I don't think that's true for ALL events. -- Zahid Ali

Don't forget about return values, most importantly with custom classes and user defined methods. You can't go wrong by simply adding "Return DODEFAULT()" to the end of the method. -- BillPlander

I noticed a problem with a cbobox.gotfocus parent class that a dodefault() command in it. You have to click the control twice to have it activate.
-- Kip Dole
See: DODEFAULT Or NODEFAULT
Category VFP Commands
( Topic last updated: 2010.06.17 10:21:45 PM )