From RAD Studio API Documentation
Jump to: navigation, search


function SetProperty(const V: TVarData; const Name: string;  const Value: TVarData): Boolean; override;


virtual bool __fastcall SetProperty(const TVarData &V, const System::UnicodeString Name, const TVarData &Value);


Type Visibility Source Unit Parent
function public
System.TypInfo TPublishableVariantType


Sets the value of a published property on the object that GetInstance returns, so that it is available in custom Variants.

SetProperty enables an application to set the properties of instances of the publishable Variant type. It implements all the settable properties that are published by the object that GetInstance returns.

When the application contains a line such as

MyVariant.SpecialProperty := NewValue;

(Delphi) or calls the Exec method of the Variant (C++), a call is automatically generated to SetProperty. If SpecialProperty is a published settable property on the object that implements the Variant's data, SetProperty sets the property on the object included in V so that the Variant's value is changed accordingly.

V is the TVarData record (Delphi) or structure (C++) from the Variant instance whose property is being set. It includes the object that the GetInstance method returns.

Name is the name of the property.

Value is a TVarData record or structure that contains the new property value.

GetProperty returns true if it sets a property value, and raises an exception of Name does not specify a published settable property on the object that GetInstance returns.

See Also