Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is it possible with ArcObjects to distinguish between the user selecting the Save Edits button and the users selecting the Stop Editing button and then saving edits?

The reason for this is that in the IEditEvents.OnStartEditing event I am acquiring references to certain tables based on the current editor workspace. These tables are used to acquire configuration parameters for an ArcMap extension and for other purposes throughout the edit session. When the edit session is closed, I clear the references to those tables and arrays generated from those tables.

The issue this has created is that when the user selects "Save Edits", IEditEvents.OnStopEditing is called followed by IEditEvents.OnStartEditing. Essentially, ArcMap is starting a new edit session. Thus, the work done during the OnStartEditing event is rerun, even though the user hasn't ended the current edit session. There is some overhead to that work that I would like to avoid if possible.

I have a workaround involving setting a shared property to the current edit workspace on the StopEditing event, and comparing that property to the new edit workspace on the StartEdting event. If they are the same then I know the edit workspace hasn't changed and I don't need to rerun the work to get table references and so forth. It seems a little messy though. I recall reading something about this at one point but can find no discussion regarding it on this forum or ESRI's.

share|improve this question
1  
Did you try using IEditEvents2.OnSaveEdits to set a flag to avoid having to reload your config? "The OnSaveEdits event is fired whenever a user issues the Save Edits command in the Editor. This event is not raised when a user stops an edit session and chooses to save edits, or if IEditor::StopEditing is called." –  Kirk Kuykendall Jan 19 '12 at 1:27
1  
Just to clarify things, the Save Edits command does actually stop the edit session and start a new one at the Workspace level. The UI command is just a convenience command in the UI. The editor events Kirk mentions are UI events to help distinguish this difference at the UI level. –  Craig Williams Jan 19 '12 at 2:36
    
@KirkKuykendall That definitely helps. I set the flag in the OnSaveEdits event. In the OnStartEditing event check to see if the flag is set and if it is not then run the setup routines. The important bit is at the end of OnStartEdting make sure to clear the flag, insuring that the flag is always cleared unless the user selected "Save Edits". Thanks for the help. If you move your comment to an answer I'll tag it as such. –  Jeff Berry Jan 19 '12 at 18:35
add comment

1 Answer

up vote 5 down vote accepted

Use IEditEvents2.OnSaveEdits to set a flag to avoid having to reload your config.

The OnSaveEdits event is fired whenever a user issues the Save Edits command in the Editor. This event is not raised when a user stops an edit session and chooses to save edits, or if IEditor::StopEditing is called.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.