         ===========================
             Class Delegation
              David Berneda.
                May-1996.
         ===========================
Please feel free to distribute this document with
        the companion example project.
       (Released to the public domain)

Dear Delphie'rs:
-----------------
Here you are a small idea for component creators that
I think could be quite useful.
I call this "Class Delegation" (I haven't found a better name yet)
that allows derived components to override the ancestor
subcomponents classes.
It's a generic concept, so can be applied to almost every
Delphi situation which involves components and subcomponents.

Explanation:
------------

Imagine a TMyPanel component that has a Button subcomponent.
This button is a TButton.

Now you derive a new TMyOtherPanel component from TMyPanel but
want also to override the TButton class to be a TBitBtn.

This is esentially the problem. And this example provides a
- maybe not elegant - solution.


I've included a demo.dpr example that tries to explain this
in practice.
The example is very simple, but same technique can be used
for more complex components.

Looking into the future, it would be nice Borland provided
a similar approach (sure it would be much better than mine)
to do things like:

"I want all controls that have and use a Canvas property to
be a TMyCanvas instead."

or...

"I want to override all TStringField instances to be TMyStringField."

I'm adding this facility to a real component and that's why
I wanted to share this with all of you.
Feel free to email me with criticisms and opinions.

Thank You !
David Berneda
101600.1067@compuserve.com
TeeChart homepage at:
http://ourworld.compuserve.com/homepages/berneda

