RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TypInfo.GetPropInfo Function

Retrieves information about a component's property.

Pascal
function GetPropInfo(Instance: TObject; const PropName: string; AKinds: TTypeKinds = []): PPropInfo; overload;
function GetPropInfo(AClass: TClass; const PropName: string; AKinds: TTypeKinds = []): PPropInfo; overload;
function GetPropInfo(TypeInfo: PTypeInfo; const PropName: string): PPropInfo; overload;
function GetPropInfo(TypeInfo: PTypeInfo; const PropName: string; AKinds: TTypeKinds): PPropInfo; overload;
C++
PPropInfo GetPropInfo(TObject * Instance, const AnsiString PropName, TTypeKinds AKinds = []);
PPropInfo GetPropInfo(TClass AClass, const AnsiString PropName, TTypeKinds AKinds = []);
PPropInfo GetPropInfo(PTypeInfo TypeInfo, const AnsiString PropName);
PPropInfo GetPropInfo(PTypeInfo TypeInfo, const AnsiString PropName, TTypeKinds AKinds);

TypInfo

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.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!