inheriting from a TListview and creating coluimns in the OnCreate

I have inherited a new component 'TLogView' from the TListView.  I have setup various 'extras' in the OnCreate and I need to create some columns.  I tried to do this in the OnCreate and I get Control "" has no parent window when I try to add the component to a form.  I tried to override the Loaded method (as according to the help this is where you would do any additional initialization after all properties have been streamed in) like so:
procedure TLogView.Loaded;
begin
  inherited Loaded;
  CreateMyCols;
end;

but creating a TLogView in the OnCreate of the form and even after setting the Parent, it does not call Loaded!

Can anyone help
djadjaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LischkeCommented:
Loaded will be called in any case where the component is instantiated with one exception: If the control is just dropped on the form in the IDE. The reason is at this point there's nothing to load from the component resource yet as all properties are just in their default state. I suggest that you override CreateWnd and after you called the inherited method you can do any initialization you like.

Ciao, Mike
0
djadjaAuthor Commented:
This seems to have worked - thanks - but is this the usual way of doing stuff that you can't (or don't want to) do in the OnCreate?
0
LischkeCommented:
I do this always so (and I do programming for a living). I use very seldom Loaded to initialize my stuff and it worked very well in classes derived from TWinControl.

Ciao, Mike
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
djadjaAuthor Commented:
I also program for a living! - Thanks again.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.