RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TypInfo.GetPropValue Function

Retrieves a component's property value as a variant.

Pascal
function GetPropValue(Instance: TObject; const PropName: string; PreferStrings: Boolean = True): Variant; overload;
function GetPropValue(Instance: TObject; PropInfo: PPropInfo; PreferStrings: Boolean = True): Variant; overload;
C++
Variant GetPropValue(TObject * Instance, const AnsiString PropName, Boolean PreferStrings = True);
Variant GetPropValue(TObject * Instance, PPropInfo PropInfo, Boolean PreferStrings = True);

TypInfo

GetPropValue utilises Delphi's RTTI (Run Time Type Information) to retrieve a a component property as a variant.  

In one form of this function, the object Instance's property is defined by a PropInfo record. GetPropInfo and GetPropList can be used to obtain such a record.  

In the other form of this function, the name of the property, PropName, is explicitly given.  

In both forms of the function, the returned value the property value as a variant.

Note: If the specified property does not exist, or is not a published property, an EPropertyError exception is thrown.
 

 

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