Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding to a Class Method
Message
De
13/03/2003 14:58:06
 
 
À
12/03/2003 08:13:01
Julie Ball
Gardner Publications, Inc.
Cincinnati, Ohio, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00764700
Message ID:
00765544
Vues:
19
This message has been marked as the solution to the initial question of the thread.
>I have a class that contains a command button. I have placed this class onto many of forms with much success. Well now I have a form that I will need to add additional code to a couple of the methods in my class. I would like for the code that already exists to run, but include the code that I need to add. How do I do this without coping the existing code to there corresponding methods and then add the new code?

Is the command button a base class command button or your own class?
If it's your own class, subclass it.
Then use DODEFAULT() to call the parent class (the original button code) followed by your new code.
Or put your new code first, followed by DODEFAULT() to run the original code afterwards.

If you're using a VFP base class, then create a new button class.
Put your original code in there.
Then go back to "if it's your own class".


If you have VFP8 it's really easy.
You don't need to put the code in the command button.
You don't need to mess with the class hierarchy.

Write the new code as a method in the form.
In that method use BINDEVENT() to delegate to your new method either before or after (it's the 5th parameter) the button's click event happens.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform