//uses TypInfo
procedure TForm1.ListStringPropClick(Sender: TObject);
var
i : integer;
lst : TStrings;
procedure ListObjectStringProp(const AObject : TObject);
var
PropList : PPropList;
i : integer;
begin
if not Assigned(AObject) then
exit;
for i := 0 to GetPropList(AObject, PropList) - 1 do
begin
if PropList.PropType^.Kind in [tkString, tkLString, tkWString] then
if (GetStrProp(AObject, PropList) <> '')
and (PropList.Name <> 'Name') then
if AObject is TComponent then
lst.Add(TComponent(AObject).Name + '.' + PropList.Name + ' = ' +
GetStrProp(AObject, PropList))
else
lst.Add(AObject.ClassName + '.' + PropList.Name + ' = ' +
GetStrProp(AObject, PropList));
if PropList.PropType^.Kind = tkClass then
ListObjectStringProp(GetObjectProp(AObject, PropList));
end;
if AObject is TCollection then
for i := 0 to TCollection(AObject).Count - 1 do
ListObjectStringProp(TCollection(AObject).Items);
end;
begin
lst := TStringList.Create;
try
ListObjectStringProp(self);
for i := 0 to ComponentCount - 1 do
ListObjectStringProp(Components);
Memo1.Text := lst.Text;
finally
lst.Free;
end;
end;