Solved

COMPONENT HIERARCHY

Posted on 2002-05-22
1
389 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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
calling Tcolordialog in dll make the form disappear 8 114
Multiple image collision 13 76
tidtcpserver connection lost handle 2 88
control image tags in a string ? 12 134
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…

832 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