Click or drag to resize

IMcGraphOverlay2Template Property

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

Namespace:  MediaCy.IQL.Display.Overlays
Assembly:  MediaCy.IQL.Display.Overlays (in MediaCy.IQL.Display.Overlays.dll) Version: 10.0.6912.0
Syntax
VB
ReadOnly Property Template ( 
	ClassName As String,
	Optional TemplateID As Integer = 0,
	Optional TemplateSelection As mcGraphOverlayTemplateSelection = mcGraphOverlayTemplateSelection.mcgtsAutoCreateTemplate
) As Object
	Get

Parameters

ClassName
Type: SystemString
The graphic object class name for the template. If an empty string and TemplateSelection is bExistingTemplatesOnly, then any class is accepted.
TemplateID (Optional)
Type: SystemInt32
An ID identifying the template (default is mcgtDefaultTemplate). Negative TemplateID values should be reserved for internal use. The template objects for the mcGraphOverlayTemplates.mcgtDefaultTemplate and mcGraphOverlayTemplates.mcgtStandardAutoDisplay TermplateID values are the same.
TemplateSelection (Optional)
Type: MediaCy.IQL.Display.OverlaysmcGraphOverlayTemplateSelection
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). The default is mcgtsAutoCreateTemplate, so that a user-default is checked for, then a previously created Template with the correct ClassName and TemplateID and finally a new Template is created if neither of those are found.

Property Value

Type: Object

Implements

IMcGraphOverlayTemplateString, Int32, mcGraphOverlayTemplateSelection
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.
Examples
VB
Dim tpl As McGraphObj, Obj As McGraphObj
'''''''''''''''''''''''''''''''''''''''''
'            Simple example
'''''''''''''''''''''''''''''''''''''''''
' Create REDID template if it does not exist.
Set tpl = overlay.Template ("McGraphObjRect",REDID)
tpl.FillColor = &Hff0000
' Now create a red rectangle
Set Obj = overlay.Add ("McGraphObjRect",REDID)
'''''''''''''''''''''''''''''''''''''''''
'            Template creation
'''''''''''''''''''''''''''''''''''''''''
' Default template for all objects
Set tpl = overlay.Template ("McGraphObj")
tpl.FillColor = &Hff0000
' Default template for Rect objects
' tpl.FillColor already set to &Hff0000
Set tpl = overlay.Template ("McGraphObjRect", mcgtDefaultTemplate)
' Set tpl = overlay.Template ("McGraphObjRect" ) ' same as above
tpl.FillColor = &H00ff00 ' Change default fill color for Rect's
' Derive a new Template from the default template for Rect objects
' Will tpl.FillColor = &H00ff00
Set tpl = overlay.Template ("McGraphObjRect",  MyID)
'''''''''''''''''''''''''''''''''''''''''
'            Other Template access
'''''''''''''''''''''''''''''''''''''''''
' Only return existing templates (empty VARIANT returned otherwise)
If IsEmpty(overlay.Template("McGraphObj",MyID, mcgtsExistingTemplatesOnly)) Then
MsgBox "Undefined Template"
' Default "system" template (not user defined in property sheet).
Set tpl = overlay.Template("McGraphObj",,mcgtsNoUserTemplates)
' Automatically generate a new template with a unique ID
Set tpl = overlay.Template("McGraphObj", ,mcgtsAutoTemplateID)
MsgBox "ID is " & tpl.TemplateID
See Also