Given the following code snippet below, using GetPropValue(MyComponent,'MySubComponent.Prop1') raises an EPropertyError exception.
How can I retrieve or set the values of SubProperties using GetPropValue / SetPropValue?
Type
TMySubComponent = class(TInterfacedPersitent)
private
FProp1: Integer;
published
property Prop1: integer read FProp1 write FProp1;
end;
TMyComponent = class(TCompoent)
private
FMySubComponent : TMySubcomponent;
published
property MySubComponent: TMySubComponent read FMySubComponent write FMySubComponent ;
end;
The dot notation you used in your question is not supported.
You need to get the Value of the SubComponent, then perform the Set and Get on the individual properties.
The TypInfo.pas method will only work with published properties, you can get the public properties with the RTTI.pas method.