Method AutomationObject():setProperty() Foundation

Sets the value of a property

:setProperty( <cName> | <nID>, [<xParam, ...>] <xValue> ) --> xValue
<cName> is the name of the property.
<nID> is the numeric ID identifying the property. The ID of a property can be queried by the method :getIDsOfNames()
<xValue> is the value that to be assigned to the property.
xParam is a comma-separated list of additional parameters that is passed to the property of the connected COM/ActiveX component.

:setProperty() returns the property value passed.


:setProperty() is used to set a value of a property exposed by a COM/ActiveX component. In case a property is accessed that is not member of the connected COM/ActiveX component, a runtime error is generated.

Normally, :setProperty() need not be called directly by applications. Instead, property values can be assigned via the assignment operator (:=).

// Property assignment via method :setProperty() 
oAuto:setProperty( "Prop", oProp ) 

is equivalent to

// Property assignment via assignment operator 
oAuto:prop := oProp 

Calling :setProperty() is required when accessing a property of a COM/ActiveX component that has the same name as an instance variable of the AutomationObject. Using :setProperty() is also required to when more than one value must be passed for qualifying the property of the connected COM/ActiveX component.

The first parameter profile

:setProperty( <cName> | <nID>, <xValue> ) --> xValue 

directly corresponds to normal property access via the assignment operator, eg.:

oCOM:Test := 1 

The second parameter profile is used for accessing properties that require parameters for qualification. To access a cell in a grid, for instance, the corresponding call to :setProperty() might look as follows:

oGrid:setProperty( "Cells", nRow, nCol, "Cell Value" ) 

When values are assigned to a property, then Xbase++ data types are automatically converted to COM/ActiveX data types. See the method :callMethod() for further reference.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.