I would like to access the following property using RTTI
MyComponent1.Property[\'variable\'].SubProperty
I would like something like that:
Index properties as all other properties (except direct references to object fields) just a shortcut to getXXX
and setXXX
methods.
Try that way:
Get all indexed properties of Ctx.GetType(MyComponent1.ClassInfo)
with GetDeclaredIndexedProperties or GetIndexedProperties
Search desired Property
in returned array of TRttiIndexedProperty instances.
Get write method description object from WriteMethod property of TRttiIndexedProperty
object found.
Get method parameters description if you need it with GetParameters call.
Call Invoke method of method description object with constructed parameter(s) list to set a property value.
Update
This works only in Delphi versions from XE2 and above.
In previous versions indexed properties can be adopted for RTTI only using things like discussed in this question.