Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

COMPONENT HIERARCHY

Posted on 2002-05-22
1
Medium Priority
?
437 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 1400 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
Integration Management Part 2
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses
Course of the Month11 days, 23 hours left to enroll

916 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