Find property as TObject in Delphi 7 -
i have 2 type of classes in delphi 7:
tphone = class(tpersistent) private fnumber: string; published property number: string read fnumber write fnumber; end; tperson = class(tpersistent) private ffirstname: string; fphone: tphone; public constructor create; published property firstname: string40 read ffirstname write ffirstname; property phone: tphone read fphone write fphone; end;
how can find phone property in tperson it's name , return tobject ?
maybe this:
function findpropbyname(aobject: tobject; apropname: string): tobject;
note phone subclass , no primitive type
thanks
this way instance:
uses typinfo; var phone: tphone; person: tperson; begin ... if propistype(person, 'phone', tkclass) phone := getobjectprop(person, 'phone') tphone; ... end;
Comments
Post a Comment