Hi,
I'm trying to develop a set of controls which all have a number of common behaviours with respect to sizing. I think that this is an instance where multiple inheritance is required (although am fully willing to accept any advice to the contrary). What I would like to do is basically a mixin pattern
class Sizable {
...
public:
ResizeMe();
ResetText();
...
};
class sizeButton : public Sizable, public TButton {
...
};
class sizeEdit : public Sizable, public TEdit {
...
};
and so forth...
I have written a non-trivial amount of sizing code in the Sizable class and tested it and it's nice, but now I have set out the rest of the structure (yes, I probably should have written a skeleton for the classes first) and have discovered that sadly:
[BCC32 Error] szButton.h(15): E2278 Multiple base classes not supported for VCL classes
I have pulled out all the functions which aren't required to be member functions (e.g. measuring the length of strings), but there are still a lot of functions where this is not possible.
Does anyone have any design advice so that I don't have to duplicate a ton of code?