Went with invoking the Setter-method to update the value. Need to add
{$RTTI EXPLICIT
METHODS([vcPublic, vcPublished, vcProtected])
PROPERTIES([vcPublic, vcPublished, vcProtected])
}
and use this code to kick Setter:
class procedure TInterfaceMethodInvoker.InvokeMethod<T>(const AIntf: IInterface; const AMathodName: string; const AValue: T);
var
LObj: TObject;
LRttiContext: TRttiContext;
LRttiType: TRttiType;
LRttiMethod: TRttiMethod;
LValue: TValue;
begin
LObj := AIntf as TObject;
LRttiContext := TRttiContext.Create;
try
LRttiType := LRttiContext.GetType(LObj.ClassInfo);
LRttiMethod := LRttiType.GetMethod(AMathodName);
LValue := TValue.From<T>(AValue);
LRttiMethod.Invoke(LObj, [LValue])
finally
LRttiContext.Free;
end;
end;
Properties information is available only for classes.
]]>So to save tons of repeating code I could use RTTI to update the properties by name. Sadly did not find any good example on RTTI and Interface properties.
If someone has code to donate or point me into the right direction, I would be very happy camper...
-Tee-
]]>