8.21.1 SET_REF Parameters
The COM parameter specifies the component or components to which the result of the reference expression specified in the TO parameter is assigned. The components specified in this parameter must have been specified with a dynamic reference in the DEFINE_COM parameter.
Note: SET_REF *create only works with object short names. It cannot load objects using their long names because in runtime long names are not available.
The TO parameter derives a component reference which is assigned to the variables named in the COM parameter. The reference expression has to be in one of the following forms:
|
The CONTEXT parameter controls how the new component reference is assigned a context in which it can obtain memory. This parameter enables management of object pooling.
By default the memory usage of objects is managed automatically by loading/unloading of a DLL or by passing of an component from one form to another. Memory is removed when no more objects are active in the pool.
The CONTEXT parameter allows you to control the memory pooling of objects programmatically, for instance you can load related objects into their own memory area.
For example you may load a large and complex form into memory then close the form but a single component (or an instance of an object) in the form may still be active and therefore the memory is not released. The CONTEXT parameter can be used to manage that form by creating a separate pool for the remaining object so that the main memory can be released.
The CONTEXT parameter can only be used when the TO parameter is set to *CREATE_AS or *CREATE_FROM. It can have one of these values:
|
The COM_ERROR parameter indicates the action to be taken when a SET_REF assignment fails. The assignment can fail because:
- It is unable to find the component DLL for the name supplied for the *CREATE_FROM/*CREATE_AS options.
- It is unable to cast the component to the class required by the variable supplied to the SET_REF's COM() parameter
The COM_ERROR parameter can have these values:
|