Table of Contents

TTMSMCPTargets.AddObject Method

Adds a target for an object, unless the object is already present.

API unit family: TMS.MCP.Attributes.Server Declaring type: TTMSMCPTargets

Syntax

function AddObject(AObject: TObject; AOwnsObject: Boolean = False): TTMSMCPTarget;

Remarks

This only records the entry. Call the method of the same name on the server to add the object and register its methods in one step. Note that ownership is only applied when the entry is actually created; an object that is already present keeps the ownership setting it was added with.

Parameters

Name Description
AObject Instance to reflect over. Its class is derived from the instance, so its ordinary methods become discoverable.
AOwnsObject When True the target frees the instance on destruction. False, the default, leaves the instance with its original owner.

Returns

The existing target for the object, the newly added target, or nil when no object was passed.