Board index » delphi » Ancestors of a class

Ancestors of a class

there is a method to know all ancestors of a given class with the rtti?

If this is not the right newsgroup where i can post this question?
best regards
Cosimo De Michele

 

Re:Ancestors of a class


On Wed, 20 Nov 2002 16:54:46 +0100, De Michele<cdemich...@tiscalinet.it>
said ...
Quote
> there is a method to know all ancestors of a given class with the rtti?

> If this is not the right newsgroup where i can post this question?
> best regards
> Cosimo De Michele

You can use ClassParent to get a class' parent. You can carry on doing
this until claassparent=nil which means there are no more ancestors..

Marc Rohloff
marc rohloff at bigfoot dot com

Re:Ancestors of a class


Next time try in .objectpascal. Here is a method that will work:

procedure TForm1.Button1Click(Sender: TObject);
begin
  ListBox1.Clear;
  ListClasses(TForm);
end;

procedure TForm1.LIstClasses(aClass: TClass);
begin
  ListBox1.ITems.Add(aClass.className);
  if (aClass.ClassParent <> nil) then
    ListClasses(aClass.ClassParent)
end;

--
Ed Dressel

Quote
"De Michele" <cdemich...@tiscalinet.it> wrote in message

news:3ddbb0b8@newsgroups.borland.com...
Quote
> there is a method to know all ancestors of a given class with the rtti?

> If this is not the right newsgroup where i can post this question?
> best regards
> Cosimo De Michele

Other Threads