This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Editor > ESRI.ArcGIS.Editor > Interfaces > IE > IEditToolEvents Interface (ArcObjects .NET 10.5 SDK) |
Provides access to events generated by the edit tool.
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.
Description | ||
---|---|---|
OnBeginMove | Called when the mouse button is first depressed. | |
OnFinishMove | Called when the left mouse button is released. | |
OnMove | Called when mouse moves while left mouse button is depressed. |
CoClasses and Classes | Description |
---|---|
EditToolEvents | Helper coclass for working with the outbound interface on noncreatable object classes in VB. |
These events are only broadcast if the user is moving the tool around the map with the left mouse button depressed.
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;
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