How to know the number of features being deleted together in an event handler?

673
4
11-06-2013 01:03 PM
SuiHuang
Occasional Contributor II
Hi Everybody:

    I am using the IEditEvents_Event.OnDeleteFeature event handler to do some operation associate with the deleted feature. The event is triggered individually for each feature that is deleted. Is there any way I can know how many features are deleted together (say, user chose 10 feature on ArcMap and click "Delete"). I want to let the event handler behave differently when people choose different number of features to delete.
   Thank you!
0 Kudos
4 Replies
DuncanHornby
MVP Notable Contributor
I've not tried this, so it may not work as you intend?

Why not listen out to the IEditEvents.OnSelectionChanged Event? If the selection exceeds your criteria you set a global boolean to TRUE so when the user attempts to delete the features your IEditEvents.OnDeleteFeature Event tests the boolean? If TRUE then follow some other logic?

Duncan
0 Kudos
KenBuja
MVP Esteemed Contributor
The IEditor has a SelectionCount property, also

This property returns the Map's total number of selected features belonging to  editable layers.
0 Kudos
SuiHuang
Occasional Contributor II
Hi Hornbydd:

    I am currently using the IEditor.SelectionCount attribute to monitor the number of features selected. However, this is not always consistent with the number of feature being deleted.
    For example, I can select 100 features, then open the Attribute Window, and then right click on one of the features in the Attribute Window and select "Delete". By doing this I am deleting one feature while 100 are selected.

I've not tried this, so it may not work as you intend?

Why not listen out to the IEditEvents.OnSelectionChanged Event? If the selection exceeds your criteria you set a global boolean to TRUE so when the user attempts to delete the features your IEditEvents.OnDeleteFeature Event tests the boolean? If TRUE then follow some other logic?

Duncan
0 Kudos
SuiHuang
Occasional Contributor II
I am current doing this, but this does not always present the number of features being deleted...

The IEditor has a SelectionCount property, also
0 Kudos