RAD Studio VCL Reference
TypInfo.SetToString Function

Returns one or more of the set values of a component's property.

function SetToString(PropInfo: PPropInfo; Value: Integer; Brackets: Boolean = False): string;
AnsiString SetToString(PPropInfo PropInfo, int Value, Boolean Brackets = False);

SetToString utilises Delphi's RTTI (Run Time Type Information) to retrieve one or more of the values of a component property that is of the set type.  

The property to interrogate is defined by a PropInfo record. GetPropInfo and GetPropList can be used to obtain such a record.  

Value defines a bit mask that selects the possible values of this property. Each bit corresponds to a set value. The low order bit corresponds to the first set value. A string is returned with the selected set values as a comma separated value string. Note that the current property set values are not taken into account - the set values selected by Value are those in the complete set.  

You may optionally set Brackets true so as to enclose this returned string within square brackets, as shown in the IDE for the property.

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


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!