uses TypInfo;
procedure PropertiesAndMethods(Obj: TObject; Items: TStrings);
var
I: Integer;
PL: TPropList;
Nam: TSymbolName;
begin
I := 0;
Items.Clear;
GetPropList(Obj.ClassInfo, tkProperties + [tkMethod], @PL);
while ((Nil <> PL[I]) and (I < High(PL))) do
begin
Nam := PL[I].Name;
Items.Add(string(Nam + ': ' + PL[I].PropType^.Name));
Inc(I);
end;
end;
// Beispiele
procedure TForm1.Button1Click(Sender: TObject);
begin
PropertiesAndMethods(Button1, Memo1.Lines);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
PropertiesAndMethods(Font, Memo1.Lines);
end;