>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.