Does anyone know how to simulate a double click in VB to turn on Sketch Edit mode programmatically?
Thanks in advance for your help.
Private Sub btnDrawTarget_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDrawTarget.Click Dim pEditTask As ESRI.ArcGIS.Editor.IEditTask GetEditorReference() startEditing(pEditor) If m_flag2 = True Then SetEvents() pEditTask = GetEditTaskByName(pEditor, "Create New Feature") pEditor.CurrentTask = pEditTask End If End Sub Private Sub GetEditorReference() Dim pID As ESRI.ArcGIS.esriSystem.UID pID = New ESRI.ArcGIS.esriSystem.UID pID.Value = "esriCore.Editor" pEditor = m_pApp.FindExtensionByCLSID(pID) End Sub Private Sub SetEvents() 'set the current tool to be the editor Sketch tool Dim pCommandItem As ESRI.ArcGIS.Framework.ICommandItem Dim pUID As New ESRI.ArcGIS.esriSystem.UID pUID.value = "esriCore.SketchTool" pCommandItem = m_pApp.Document.CommandBars.Find(pUID) m_pApp.CurrentTool = pCommandItem m_pEditEvents = pEditor End Sub Private Sub startEditing(ByRef pEditor As ESRI.ArcGIS.Editor.IEditor) Try Dim pMxDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument Dim pMap As ESRI.ArcGIS.Carto.IMap Dim pfeaturelayer As ESRI.ArcGIS.Carto.IFeatureLayer Dim pDataset As ESRI.ArcGIS.Geodatabase.IDataset Dim pEditLayers As ESRI.ArcGIS.Editor.IEditLayers Dim msg As Object pMxDoc = m_pApp.Document pMap = pMxDoc.FocusMap pEditLayers = pEditor 'Check to see if proper dataset is loaded before editing, if so, then edit Dim i, idx As Integer Dim pGeoFeatureLayer As ESRI.ArcGIS.Carto.IGeoFeatureLayer m_flag2 = False For i = 0 To pMxDoc.FocusMap.LayerCount - 1 If (TypeOf pMxDoc.FocusMap.Layer(i) Is ESRI.ArcGIS.Carto.IGeoFeatureLayer) Then pGeoFeatureLayer = pMxDoc.FocusMap.Layer(i) If pGeoFeatureLayer.Name = "The Name of The Layer you Want to Edit Goes Here" Then m_flag2 = True idx = i Exit For End If End If Next i If m_flag2 = True Then pfeaturelayer = pMap.Layer(idx) pDataset = pfeaturelayer.FeatureClass pEditor.StartEditing(pDataset.Workspace) pEditor.StartOperation() pEditLayers.SetCurrentLayer(pfeaturelayer, 0) End If Catch ex As Exception MsgBox(ex.ToString) Exit Sub End Try End Sub
Hi James,
Thanks for replying.
I got the code to turn on the Editor and select the line segment I want but Edit Sketch doesn't know its geometry. For Edit Sketch to know about its geometry I have to double clik on the line segment manually and I want to program the double click because I have a list of line segments that I want to go through and edit.
Thanks!
Hi James,
That is OK if you can't help anymore.
Just so you know ... I have a layer of polylines and for each of these polyline, I want to insert a vertex on it (besides its existing vertices) at a known X,Y coordinates. I got most everything figured out except how to turn on its Edit Sketch Properties. Manually, when you double click on a polyline you would see all its vertices. And I want to do this via the codes.
I know VB 6, VB.Net and C also. So if you have the codes in these languages, that will work too.
Thanks, James.
I want the codes to go through the polyline layer and for each polyline, insert a vertex at its corresponding X,Y in the point layer.