Description

Read-only property used to access the graphic object templates.

Property type

An Object object.  

Syntax

object.Template(ClassName, [TemplateID], [TemplateSelection])

The Template Property syntax has these parts:

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

The graphic object class name for the template. If an empty string and TemplateSelection is bExistingTemplatesOnly, then any class is accepted.

TemplateIDOptional. A Long value.

An ID identifying the template (default is mcgtDefaultTemplate). Negative TemplateID values should be reserved for internal use.

TemplateSelectionOptional. A mcGraphOverlayTemplateSelection enumeration, as described in settings.

Specify which template to return or create. The mcgtsNoUserTemplates value can be OR'ed with others to avoid returning any template associated with checking the "Set as default" in an object property dialog.

If mcgtsExistingTemplatesOnly is set, then an empty variant will be returned unless the specified Template already exists (if ClassName is an empty string, the first template with the specified TemplateID in any class will be returned).

If mcgtsAutoTemplateID, then a new template will be created for the class given by ClassName. It will be given a unique ID value (this will be a negative number).

Settings

The settings for TemplateSelection are:

ConstantValueDescription
 mcgtsAutoCreateTemplate0

create a template if the TemplateID parameter does not match an existing template.

 mcgtsExistingTemplatesOnly1

return an empty variant if the TemplateID parameter does not match an existing template.

 mcgtsNoUserTemplates2

do not return templates marked “use as default” in property sheets.

 mcgtsAutoTemplateID4

ignore TemplateID and automatically generate a new ID.

Remarks

Templates are used to hold object properties, as such they share the same classes as the objects for which they serve as a model (McGraphObj and its derived interfaces). When a new object is created, the initial value of its properties is copied from a template identified by its TemplateID in the Add method.

This property will never fail when an existing ClassName is provided and the Static parameter is False. If the template with the given ID does not exist, it will be created.

Exceptions

The combination of mcgtsAutoTemplateID with mcgtsExistingTemplatesOnly for the TemplateSelection argument is illegal. If ClassName is an empty string, then the TemplateSelection argument must have mcgtsExistingTemplatesOnly. A TemplateID value of mcgtAnyTemplate (-1) is illegal.