Solved

COMPONENT HIERARCHY

Posted on 2002-05-22
1
391 Views
Last Modified: 2010-04-04
COMPONENT HIERARCHY

How to know component hierarchy ?

For example : TLabel
-----
TObject
TPersistent
TComponent
TControl
TWidgetControl
TFrameControl
TCustomLabel
TLabel
-----

Thanks.
0
Comment
Question by:cvbmn
1 Comment
 
LVL 27

Accepted Solution

by:
kretzschmar earned 350 total points
ID: 7028233
from the delphi help file:

This example shows how to obtain the ancestry of a component using the ClassType and ClassParent properties.  It uses a button and a list box on a form. When the user clicks the button, the name of the button’s class and the names of its parent classes are added to the list box.

procedure TForm1.Button1Click(Sender: TObject);

var
  ClassRef: TClass;
begin
  ListBox1.Clear;
  ClassRef := Sender.ClassType;
  while ClassRef <> nil do
  begin
    ListBox1.Items.Add(ClassRef.ClassName);
    ClassRef := ClassRef.ClassParent;
  end;

end;

The list box contains the following strings after the user clicks the button:

TButton
     TButtonControl
     TWinControl
     TControl
     TComponent
     TPersistent
     TObject

meikl ;-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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