How to get selected feature by the order of user's selection?

717
2
04-08-2011 12:21 AM
SongWendong
New Contributor
It seems that the order of IEnumFeature is by the OBJECTID field.
0 Kudos
2 Replies
TroySchmidt
New Contributor
Seems to me like you would have to add the selection changed event and do some kind of computation in there to keep track of the order features are added to the selection.
0 Kudos
JillMasters
New Contributor
Not sure of your exact scenario or what you are trying to do...

If you are listening for edits (for example: Public WithEvents EditorEvents As Editor), you can identify each edited feature as it loops through the _onchange event. For example, you could assign "varFeatureID=obj.OID" via an editor event subroutine such as "Private Sub EditorEvents_OnChangeFeature(ByVal obj As IObject)" which passes each feature as "obj".

A simultaneous edit to multiple features results in each feature (i.e, "obj") looping through the _OnChangeFeature one at a time until the batch edit completes. So you could collect information about each feature in an array as each feature object looped through the _OnChangeFeature event.

Also note that users can make a group selection across more than one feature class (unless restricted from doing so) but only selections in the highlighted feature class (attribute window) or current table (attribute table) are processed. Therefore, in this scenario selectioncount and actual number of batched features edited willl not match!

Would like more details. I am always interested in new ways to structure solutions.
0 Kudos