RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TPublishableVariantType.SetProperty Method

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

Pascal
function SetProperty(const V: TVarData; const Name: string; const Value: TVarData): Boolean; override;
C++
virtual __fastcall Boolean SetProperty(const TVarData V, const AnsiString Name, const TVarData Value);

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. 

 

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