>Can I have a class that can modify a textbox class and a spinner class
>at the same time ?
>I want to use a new property or the same method in both classes.
>
>For example:
>
>I want the lostfocus event execute the same thing for both classes, without
>using an external function, and I want to declare a new property that can
>be used in both too.
You can't do exactly what you want because you can't change FoxPro's class hierarchy (BTW, there's no such thing :))).
But you can define a Behavior class. This Behavior must have all common methods. Your classes will have a property that will keep a reference to a Behavior object. All methods for this classes will just call the the corresponding methods of Behavior object.
Advantages:
1. You can have many Behavior classes and change them at runtime. (It's like you would change the class hierarchy at runtime!!);
2. Behavior classes can have also a property that will point to another behavior object. This is extremly good because you can chain Behaviors.
Disadvantage: You can not do the same thing for properties since there is no possibility to call (automatically) a method everytime a property is used (like you can do in Visual C++). And this is a VERY BIG lack of VFP.
Vlad
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only