[Overview][Constants][Types][Classes][Procedures and functions] | Reference for unit 'typinfo' (#rtl) |
Return property information by property name.
Source position: line 0
function FindPropInfo( |
Instance: TObject; |
const PropName: String |
):PPropInfo; |
AClass: TClass; |
const PropName: String |
):PPropInfo; |
FindPropInfo examines 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 EPropertyError exception will be raised. The GetPropInfo function has the same function as the FindPropInfo function, but returns Nil if the property does not exist.
Specifying an invalid property name in PropName will result in an EPropertyError exception.
|
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.
No notes exist for this page yet.