System.TypInfo.GetPropInfo
Delphi
function GetPropInfo(TypeInfo: PTypeInfo; const PropName: string): PPropInfo;
function GetPropInfo(TypeInfo: PTypeInfo; const PropName: string; AKinds: TTypeKinds): PPropInfo;
function GetPropInfo(Instance: TObject; const PropName: string; AKinds: TTypeKinds): PPropInfo;
function GetPropInfo(AClass: TClass; const PropName: string; AKinds: TTypeKinds): PPropInfo;
C++
extern DELPHI_PACKAGE PPropInfo __fastcall GetPropInfo(PTypeInfo TypeInfo, const System::UnicodeString PropName)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.TypInfo.pas System.TypInfo.hpp |
System.TypInfo | System.TypInfo |
Description
Retrieves information about a component's property.
GetPropInfo utilises Delphi's RTTI (Run Time Type Information) to retrieve a pointer to a property information record for a component.
In the first form of this function, TypeInfo specifies the component type whose property you want to retrieve. PropName specifies the property name as a string. You may optionally specify a AKinds set of TTypeKind property value types that the property must belong to.
The second form of the function is similar to the first, with AClass replacing TypeInfo as the means of specifying the component type. AKinds is now a required value.
The final form of the function is like the second form, with Instance specifying a component instance.
In all forms of the function, the returned value is a pointer to a TPropInfo value. This provides rich data about the property being investigated at run time. This enables more elegant component processing than can be achieved with hard coded component names/properties.
Note: If the specified property does not exist, a nil pointer is returned.