Description

Create and add a new McGraphObj to the collection.

Return Type

An Object object.  

A new McGraphObj instance.

Syntax

object.Add (Class, [TemplateID], [CopyTemplate])

The Add Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McGraphOverlay.
ClassRequired. A String value.

The class name for the new object (ServerName.ObjectName). Builtin classes are McGraphObjRect, McGraphObjRRect, McGraphObjEllipse, McGraphObjCircle, McGraphObjPoint,McGraphObjPoly,McGraphObjText, and McGraphObjGroup. The ServerName part of the Class name can be omitted for builtin classes. Instances of user defined classes implementing McGraphObjServer can also be added using the standard ServerName.ObjectName syntax.

TemplateIDOptional. A Long value.

The template to copy properties from (default is mcgtDefaultTemplate).

CopyTemplateOptional. A Boolean value.

Copy template properties if True (default).

Remarks

You must call the NotifyCreationComplete method before any object created or coordinate move notifications will be sent to notify clients (see example).

You may specify a Template ID for the template object to be used as a pattern for the new one (assuming the CopyTemplate is passed in as the default, TRUE). If no template object of the specified Class already exists, one is automatically created. Properties of this automatically created template (and thus the displayed graphic object) are taken from the closest existing base template object with the given template ID, and if none such exists then from the default template (the one with TemplateID mcgtDefaultTemplate).

Notes

As illustrated in the example, a call to the NotifyCreationComplete method must be made before any notifications that the object was created or moved will be sent to notify clients of the McGraphOverlay (the Overlay property). This serves two purposes: it avoids sending a bunch of expensive notifications during the process of object creation. It also allows an abort to be performed (as when the object is being created via user interaction) at any time until the NotifyCreationComplete method call is made without notify clients having to undo their object tracking.