[Overview][Constants][Types][Classes][Procedures and functions] |
Return property information by property name.
Source position: line 0
function FindPropInfo( |
Instance: TObject; |
const PropName: String |
):PPropInfo; |
AClass: TClass; |
const PropName: String |
):PPropInfo; |
FindPropInfoexamines the published property information of a class and returns a pointer to the property information for property PropName. The class to be examined can be specified in one of two ways:
If the property does not exist, a EPropertyErrorexception will be raised. The GetPropInfofunction has the same function as the FindPropInfofunction, but returns Nilif the property does not exist.
Specifying an invalid property name in PropNamewill result in an EPropertyErrorexception.
|
Return property type information, by property name. |
|
|
Return a list of a certain type of published properties. |
|
|
Return a list of published properties. |
Program example13; { This program demonstrates the FindPropInfo function } {$mode objfpc} uses rttiobj,typinfo,sysutils; Var O : TMyTestObject; PT : PTypeData; PI : PPropInfo; I,J : Longint; PP : PPropList; prI : PPropInfo; begin O:=TMyTestObject.Create; PI:=FindPropInfo(O,'BooleanField'); Writeln('FindPropInfo(Instance,BooleanField) : ',PI^.Name); PI:=FindPropInfo(O.ClassType,'ByteField'); Writeln('FindPropInfo(Class,ByteField) : ',PI^.Name); Write ('FindPropInfo(Class,NonExistingProp) : '); Try PI:=FindPropInfo(O,'NonExistingProp'); except On E: Exception do Writeln('Caught exception "',E.ClassName,'" with message : ',E.Message); end; O.Free; end.