Currently doing some research on RTTI in delphi.
The problem that arises is the following.
For this example I have a TPanel component (created from code and the owner is passed by the invoke method) Now the TPanel is cast to a TObject (to keep the methods I use generic).
Now I try to set that property via the SetXXXXXXProp function (XXXXXX is any of the following (ord, variant, str, method.... basically I tried all of the SetProperty functions.)
But for some odd reason the message I receive is that there is no Parent property. How can I set my Parent property??
So I hope any of you can give me a 'Pointer' in the right direction.
class procedure TComponentsCreator.AddParent(obj, parent : TObject);
var
count : integer;
propList: PPropList;
I: Integer;
method : TMethod;
begin
count := GetPropList(obj, propList);
for I := 0 to count -1 do
begin
WriteLn(propList[i]^.Name);
if (CompareStr(LowerCase(String(propList[i]^.Name)), LowerCase('Parent')) = 0) then
begin
SetObjectProp(obj, String(propList[i]^.Name), parent);
end;
end;
end;