Responding to changes in the edit environment (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > Editing data > ArcGIS for Desktop editing for developers > Working with editing events > Responding to changes in the edit environment (ArcObjects .NET 10.6 SDK)

Responding to changes in the edit environment


Summary
This topic describes the events the editor provides that allow developers to listen and respond to changes in the edit environment.

In this topic


Editing environment changes

The editor provides a rich set of events that allow developers to respond to a variety of changes that impact their customizations. Some of the most important events for developers are related to changes in the editor's CurrentTemplate property. 
Tools, commands, construction tools, or shape constructors that create features or add geometry to the edit sketch usually require some conditions be satisfied before enabling. In these cases, most of these customizations listen to IEditEvents5.OnCurrentTemplateChanged. For example, some tools only create polygons, so each time the editor's CurrentTemplate property changes, the tool must determine whether or not the geometry type satisfies the condition, and enables or disables itself based on that information.
Customizations that display or cache EditTemplates should listen to the following events to ensure that they are being properly synchronized when changes to the EditTemplate list occurs:
For more information on feature templates and how they are utilized within the editing environment, see Using feature templates.

COGO environment changes

Some tools, particularly those that work in a non-modal state, must listen to changes in the editing environment. One of these areas is in coordinate geometry (COGO) development, where a number of properties, such as IEditProperties2.UseGroundToGrid, significantly influence the behavior of the tool or command. In these instances, a number of events are available to listen to these types of changes. In most cases, these tools and commands must abort or invalidate to avoid incorrect results when these values are applied at the end of an editing operation.
Any customizations that utilize or store COGO-related properties should also listen and invalidate when any of the following events are fired:

Selection changes

Tools and commands that operate against a selected set of features might require some conditions be satisfied before enabling. In these cases, most of these customizations listen to IEditEvents.OnSelectionChanged.
For example, some commands only work against a single editable feature. Each time the editor's selection changes, the command must determine whether or not one feature is selected and that it is editable, both of which can be determined by evaluating IEditor.SelectionCount
If a specific type of geometry is required, get the editor's selection from IEditor.EditSelection and enumerate over the selected features to determine whether or not the selected features meet the necessary criteria.
The IEditEvents.OnSelectionChanged event fires frequently during the course of a typical edit session. Ensure that any code that is executed inside the event handler is not overly complex, and avoid running unnecessary code.
If your customization manipulates the map's selection, and might result in potentially large selections being made, consider delaying the OnSelectionChanged event until you have completed the selection process. Once you stop delaying event notification, the OnSelectionChanged event will fire once so listening clients are properly informed without excessive messaging.






Development licensing Deployment licensing
ArcGIS Desktop Advanced ArcGIS Desktop Advanced
ArcGIS Desktop Standard ArcGIS Desktop Standard
ArcGIS Desktop Basic ArcGIS Desktop Basic