Skip to content

GetPropValue

Return a property value as a variant.

Declaration

Source position: variants.pp line 352

function GetPropValue(Instance: TObject; PropInfo: PPropInfo; 
                     PreferStrings: Boolean) : Variant;  overload; overload;

Arguments

Name Description
Instance Instance from which to get property value.
PropInfo Pointer to property information (RTTI).
PreferStrings Try to cast to string.

Function result

Property value as variant.

Description

GetPropValue returns the value of the property described by PropInfo from the Instance. The property value is returned as a variant type.

when PreferStrings is true, the implementation will tend to cast to a string-valued variant when a conversion must be done.

This function is used as the value for the TypInfo unit's OnGetPropValue callback. This callback is automatically initialized with the function when the variants unit is used.

See also

Name Description
TypInfo Access Run-Time Type Information (RTTI).
TypInfo.OnGetPropValue Callback to get a property value as a variant.
SetPropValue Set a property value as a variant.