Accessing record field by reference

808 Views Asked by At

I have to use records in Lazarus (due to TVirtualStringTree).

If I have a simple record:

type
  myrec = record
    name: string;
  end;

Is there a way how to access the field by reference? i.e. to make a function:

getField('name', searchRecord);

or is there a way how to iterate over fieldnames?

1

There are 1 best solutions below

0
On

i guest you can use JSON theres fpjson unit on lazarus

http://freepascal.org/docs-html/fcl/fpjson/index.html