[Webinar] Streamline your web hosting managementRegister Today


inheriting from a TListview and creating coluimns in the OnCreate

Posted on 1999-11-03
Medium Priority
Last Modified: 2010-04-04
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;
  inherited Loaded;

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

Can anyone help
Question by:djadja
  • 2
  • 2
LVL 10

Expert Comment

ID: 2180638
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

Author Comment

ID: 2180695
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?
LVL 10

Accepted Solution

Lischke earned 80 total points
ID: 2180709
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

Author Comment

ID: 2182426
I also program for a living! - Thanks again.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Suggested Courses

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question