Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling method
Message
 
 
To
08/02/1999 13:43:05
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Miscellaneous
Thread ID:
00185088
Message ID:
00185343
Views:
29
Hi John,

DoDefault() fixed for a while now. You are correct: I believe that VFP 5.0 (no service packs) had a problem with DoDefault() if the method of the direct superclass was empty:
AbstractClass (Execute method has code in it)
   +-- subclasslevel1 (Execute method has no code)
       +-- subclasslevel 2 ( execute method overridden and call to DoDefault())
A DoDefault() in Execute() of subclasslevel2 would not run the code in AbstractClass execute method.

I believe that this was fixed in VFP 5.0a.

DoDefault() has been working for at least 2 service packs. It comes in very handy in the situation where containership in a class causes weird long scope resolution (eg AbstractClass::Execute() ) statements. For instance, you have a class called MyForm that has a container called MyContainer on it which in turn has a command button MyCommandButton on it. It is a common mistake when overriding the code in the click of MyCommandButton.Click() to call up the hierarchy of the base commandbutton:

eg.
MyCommandbutton.Click
------------------------
WAIT WINDOW "I'm Clicking"
Commandbutton::Click()
The problem is that the correct call is MyForm.MyContainer.MyCommandButton::Click()

DoDefault() saves you from having to remember that. It also prevents havoc that arises if you ever have to redefine the superclass of any of the classes involved

>Hiya Rick ---
>
>Or you can directly call the Parent event/method with:
>
>ParentClass::Init()
>
>Wasn't there something squirelly with DODEFAULT() at one time?
>
>
>>
>>In VCX
>>Init
>>?"Hello"
>>...
>>llSuccess = .T.
>>RETURN .T.
>>
>>In form
>>Init
>>?"1st Hello"
>>llRetVal = DoDefault()
>>RETURN llRetVal
>>
>>
>>
>>>Hi,
>>> Let's said I have already some codes in a particular event or method - Init event which in the control's class. Then, When i drop the control into form, I have added some new code into the same event mentioned previously and I want the original code execute after the new code.....
>>>e.g.
>>>In .vcx
>>> Init
>>> ?"Hello"
>>>
>>>After added into form
>>> Init
>>> ?"1st Hello..."
>>> call .vcx's Init
>>>
>>>How to do so?
Rick Hodder
MCP Visual Foxpro
C#, VB.NET Developer
Independent Consultant
www.RickHodder.com
MyBlog
Previous
Reply
Map
View

Click here to load this message in the networking platform