This document is archived and information here might be outdated. Recommended version. |
IEditTemplateManager Interface
Name | Description | |
---|---|---|
Count | The number of available edit templates. | |
EditTemplate | The edit template at the specified index. |
CoClasses and Classes | Description |
---|---|
EditTemplateManager | EditTemplateManager Class |
Feature templates for a layer can be accessed via this interface as a layer extension. The methods on this interface can be used outside an edit session.
The example below returns all feature templates from the layers in a map document to an array.
Dim pMap As IMap
Dim ipDoc As IMxDocument
ipDoc=CType(m_ipApp.Document, IMxDocument)
pMap=ipDoc.FocusMap
Dim templates As New ArrayList
'loop through finding the templates
Dim pLayer As IFeatureLayer
Dim idx As Integer
For idx=0 To pMap.LayerCount - 1
pLayer=pMap.Layer(idx)
Try
'cast to ILayerExtensions
Dim ipLayerExt As ILayerExtensions
ipLayerExt=CType(pLayer, ILayerExtensions)
'loop through looking for the editTemplateManager
Dim jdx As Integer
For jdx=0 To ipLayerExt.ExtensionCount - 1
Dim obj As Object=ipLayerExt.Extension(jdx)
If TypeOf obj Is IEditTemplateManager Then
Dim ipEditTemplateMgr As IEditTemplateManager
ipEditTemplateMgr=CType(obj, IEditTemplateManager)
Dim kdx As Integer
For kdx=0 To ipEditTemplateMgr.Count - 1
templates.Add(ipEditTemplateMgr.EditTemplate(kdx).Name)
Next
End If
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Next