How to get property of the 'record' type using TypInfo unit

Viewed 923

I have this record type

TDoublePoint = record
               X : Double;
               Y : Double;
               end;

then I have object with this property

uses ..TypInfo;

TCell = class(TPersistent)
  private
    FZoom : TDoublePoint 
  published
    property Zoom : TDoublePoint read FZoom write FZoom;
end;

But when I want to get PropInfo of this property with this function:

function GetKind(AObject:TObject; Propertyname :shortstring):TTypeKind;
var p :ppropinfo;
begin
  p:=GetPropInfo(AObject, Propertyname);  // <p = nil
  Result:= p^.proptype^.Kind;
end;

.. ..

c := TCell.Create;
GetKind(c, 'Zoom');  //   <- error
c.Free;

I get error, because variable p is nil in the function.

But Why? There is tkRecord in the TTypeKind, so I expected no problems to read/write the property of record type, but it seems, it is not possible (?) Google search did not tell much.

1 Answers
Related