> > That's why I like to create the component with owner of self (ie the
form).
> > When the form is destroyed the component will automatically be
destroyed. Of
> > course it always depends what you are doing. Chrissy mentioned she had
> > problems using .Create(self) but that is probably being caused by code
> > elsewhere - the concept works.
>
> My problem was that the Create method wanted to TTreeView and Self was a
> form.   There was no other code other than the standard Delphi stuff for a
form
> with one button and the unit that had the my class in it.  The only code
in this
> unit was a Create method the called the inherited method.  I do not think
that
> the other code was causing the problem but what fixed it was using "nil".
>
That is very unusual. TTreeView.Create should be defined as:

    constructor Create(AOwner: TComponent); override;

A form is a TComponent so you should be able to pass it in as AOwner. Maybe
your new TTreeView version has a different Create constructor? In which case
I would suggest you modify your version to have AOwner as one of it's
parameters (and make sure you call "inherited Create(AOwner)" as the first
thing your constructor does.

David.

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to