Search code examples
delphidelphi-xe

How can I set "record" value using TRttiProperty.setValue()?


How can I set the value of the TPoint property using TRttiProperty.setValue()? Or any other property of type record?


Solution

  • I would do it like this:

    Vertex: TPoint;
    Val: TValue;
    
    ...
    
    Vertex := Point(1, 22);
    TValue.Make(@Vertex, TypeInfo(TPoint), Val);
    Prop.SetValue(Self, Val);