Procedure Clone(C, C2: TObject);
Var List: PPropList;
i, i2: Integer;
Begin
i2 := GetPropList(C.ClassInfo, List);
If i2 > 0
Then
Try
For i := 0
to i2 - 1
do
If IsStoredProp(C, List[i].
Name)
and not MatchText(List[i].
Name, ['
Name', '
Parent'])
Then
Case List[i].PropType^.Kind
of
tkInteger, tkEnumeration, tkChar, tkWChar:
SetOrdProp (C2, List[i].
Name, GetOrdProp (C, List[i].
Name));
tkInt64: SetInt64Prop (C2, List[i].
Name, GetInt64Prop (C, List[i].
Name));
tkSet: SetSetProp (C2, List[i].
Name, GetSetProp (C, List[i].
Name));
tkFloat: SetFloatProp (C2, List[i].
Name, GetFloatProp (C, List[i].
Name));
tkLString: SetAnsiStrProp (C2, List[i].
Name, GetAnsiStrProp (C, List[i].
Name));
tkWString: SetWideStrProp (C2, List[i].
Name, GetWideStrProp (C, List[i].
Name));
{$IF Declared(UnicodeString)}
tkString, tkUString:
GStUnicodeStrProp(C2, List[i].
Name, GetUnicodeStrProp(C, List[i].
Name));
{$ELSE}
tkString: SetAnsiStrProp (C2, List[i].
Name, GetAnsiStrProp (C, List[i].
Name));
{$IFEND}
tkClass: SetObjectProp (C2, List[i].
Name, GetObjectProp (C, List[i].
Name));
tkMethod: SetMethodProp (C2, List[i].
Name, GetMethodProp (C, List[i].
Name));
tkVariant: SetVariantProp (C2, List[i].
Name, GetVariantProp (C, List[i].
Name));
Else Raise Exception.Create('
Propertytyp wird nicht unterstützt');
End;
Finally
FreeMem(List);
End;
End;