This document is archived and information here might be outdated.  Recommended version.


IEditToolEvents Interface (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Editor)  

IEditToolEvents Interface

Provides access to events generated by the edit tool.

Product Availability

Available with ArcGIS Desktop.

When To Use

Wire up this event interface if you are interested in tracking the outbound events triggered by the interaction of the Edit Tool over the map.

Members

Description
Event OnBeginMove Called when the mouse button is first depressed.
Event OnFinishMove Called when the left mouse button is released.
Event OnMove Called when mouse moves while left mouse button is depressed.

CoClasses that implement IEditToolEvents

CoClasses and Classes Description
EditToolEvents Helper coclass for working with the outbound interface on noncreatable object classes in VB.

Remarks

These events are only broadcast if the user is moving the tool around the map with the left mouse button depressed.

[C#]

The following code block illustrates now to configure a client to access the edit tool's events, and reports the number of times each event is fired when moving the edit tool.

The code assumes you have a reference to the application. You will also need to reference ESRI.ArcGIS.SystemUI (for ICommand) in addition to the libraries implied within the code.

public void SetupEditToolEvents()
{
  //get the edit tool
  ESRI.ArcGIS.Editor.IEditTool editTool=m_application.Document.CommandBars.Find(
    "Editor_EditTool", true, true).Command as ESRI.ArcGIS.Editor.IEditTool;
  //hook up the events
  ((ESRI.ArcGIS.Editor.IEditToolEvents_Event)editTool.EventSource).OnBeginMove += new 
    ESRI.ArcGIS.Editor.IEditToolEvents_OnBeginMoveEventHandler(EditToolEvents_StartCmd_OnBeginMove);
  ((ESRI.ArcGIS.Editor.IEditToolEvents_Event)editTool.EventSource).OnMove += new 
    ESRI.ArcGIS.Editor.IEditToolEvents_OnMoveEventHandler(EditToolEvents_StartCmd_OnMove);
  ((ESRI.ArcGIS.Editor.IEditToolEvents_Event)editTool.EventSource).OnFinishMove += new  
    ESRI.ArcGIS.Editor.IEditToolEvents_OnFinishMoveEventHandler(EditToolEvents_StartCmd_OnFinishMove);      
}
void EditToolEvents_StartCmd_OnMove(ESRI.ArcGIS.Geometry.IPoint loc)
{
  i += 1;
}
void EditToolEvents_StartCmd_OnFinishMove(ESRI.ArcGIS.Geometry.IPoint loc)
{
  j += 1;
  System.Windows.Forms.MessageBox.Show(string.Format("OnBeginMove fired: {0}, OnMove fired: {1}, OnFinishMove fired: {2}",k,i,j));
}
void EditToolEvents_StartCmd_OnBeginMove(ESRI.ArcGIS.Geometry.IPoint loc)
{      
  //reset counter
  i=0;
  j=0;
  k=0;
  //start counting 
  k += 1;
}
int i, j, k=0;

See Also

IDatasetEdit Interface | IDatasetEditInfo Interface | IEditSketch Interface | IEditTask.Activate Method | IEditor Interface | IEditTask.Deactivate Method | ISnapEnvironment Interface | IEditEvents2 Interface | IEditLayers Interface | IEditEvents Interface | IEditTask.Name Property | Editor Class | Editor Library | IEditTask.OnFinishSketch Method | IEditAttributeProperties Interface | IEditTask.OnDeleteSketch Method | IEditProperties Interface | EditTool Class | IEditTool Interface