<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Prevent OnChangeFeature event from firing within itself? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243353#M6311</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What are you recording in the text field?&amp;nbsp; Something like:&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"This feature changed on: 2014-04-22 13:54:00"&amp;nbsp; Changed how?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What to you signals the change event you want to record?&amp;nbsp; Everything?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Such as:&amp;nbsp; every time I move a vertex, you want the text field updated, but at some point that field will get over written with the most recent change event.&amp;nbsp; So what are you planning on putting in the text field?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The ESRI sample for edit events only prints information.&amp;nbsp; It doesn't try to update a feature within a OnChageFeatureEvent.&amp;nbsp; At the least, your event is going to fire a minimum of two times for every change.&amp;nbsp; Once for the change you log, and once for the change you make even outside of the change event and you will run into the same problem with an additional method to handle the text field update.&amp;nbsp; You'll have to come up with a hack to prevent re-logging the same event.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are three different events for vertexes alone.&amp;nbsp; Added, deleted and moved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe you need to implement the IEngineEditEvents in your code that signal the event you really want to record.&amp;nbsp; My guess is OnChangeFeature was meant to log this information somewhere else, not in the featureclass you are changing.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Apr 2014 20:18:02 GMT</pubDate>
    <dc:creator>LeoDonahue</dc:creator>
    <dc:date>2014-04-22T20:18:02Z</dc:date>
    <item>
      <title>Prevent OnChangeFeature event from firing within itself?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243350#M6308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an OnChangeFeature event wired to fire whenever a feature is changed (obviously).&amp;nbsp; Within the event, I am updating a field value, which then fires the event again.&amp;nbsp; Hence, infinite loop.&amp;nbsp; How can I prevent this from happening?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried to remove the event within itself by using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;editEvents.OnChangeFeature -= new IEditEvents_OnChangeFeatureEventHandler(OnChangeFeature);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...which works, but only if I don't add the event back (with a +=) afterward, which I need to do.&amp;nbsp; If I add the event back, even after the field update, the event fires again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Evan.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 17:12:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243350#M6308</guid>
      <dc:creator>EvanBlaisdell</dc:creator>
      <dc:date>2014-04-22T17:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent OnChangeFeature event from firing within itself?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243351#M6309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello,I have an OnChangeFeature event wired to fire whenever a feature is changed (obviously).&amp;nbsp; Within the event, I am updating a field value, which then fires the event again.&amp;nbsp; Hence, infinite loop.&amp;nbsp; How can I prevent this from happening?&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;This is an application logic issue.&amp;nbsp; Are there no other options for you to not attempt a field update within that event?Can you explain your use case for needing to do this in the event?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 18:58:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243351#M6309</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2014-04-22T18:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent OnChangeFeature event from firing within itself?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243352#M6310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This is an application logic issue.&amp;nbsp; Are there no other options for you to not attempt a field update within that event?Can you explain your use case for needing to do this in the event?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to update a text field to indicate the fact that the feature has been changed, no matter how it was changed, e.g. via a split, merge, moving a vertex, etc.&amp;nbsp; I know there is Editor Tracking but that won't work in my situation due to unrelated issues.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 19:15:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243352#M6310</guid>
      <dc:creator>EvanBlaisdell</dc:creator>
      <dc:date>2014-04-22T19:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent OnChangeFeature event from firing within itself?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243353#M6311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What are you recording in the text field?&amp;nbsp; Something like:&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"This feature changed on: 2014-04-22 13:54:00"&amp;nbsp; Changed how?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What to you signals the change event you want to record?&amp;nbsp; Everything?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Such as:&amp;nbsp; every time I move a vertex, you want the text field updated, but at some point that field will get over written with the most recent change event.&amp;nbsp; So what are you planning on putting in the text field?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The ESRI sample for edit events only prints information.&amp;nbsp; It doesn't try to update a feature within a OnChageFeatureEvent.&amp;nbsp; At the least, your event is going to fire a minimum of two times for every change.&amp;nbsp; Once for the change you log, and once for the change you make even outside of the change event and you will run into the same problem with an additional method to handle the text field update.&amp;nbsp; You'll have to come up with a hack to prevent re-logging the same event.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are three different events for vertexes alone.&amp;nbsp; Added, deleted and moved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe you need to implement the IEngineEditEvents in your code that signal the event you really want to record.&amp;nbsp; My guess is OnChangeFeature was meant to log this information somewhere else, not in the featureclass you are changing.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 20:18:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243353#M6311</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2014-04-22T20:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent OnChangeFeature event from firing within itself?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243354#M6312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Make sure you're not calling IFeature.Store in the event as this will re-fire the behavior. Its called internally once the event is complete.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp; public class EditorExtension1 : ESRI.ArcGIS.Desktop.AddIns.Extension &amp;nbsp; {&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; private IEditEvents_Event _editEvents; &amp;nbsp;&amp;nbsp;&amp;nbsp; private int i = 0;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; public EditorExtension1() &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; protected override void OnStartup() &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IEditor theEditor = ArcMap.Editor; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _editEvents = theEditor as IEditEvents_Event; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _editEvents.OnChangeFeature += new IEditEvents_OnChangeFeatureEventHandler(_editEvents_OnChangeFeature); &amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; void _editEvents_OnChangeFeature(ESRI.ArcGIS.Geodatabase.IObject obj) &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeature feature = obj as IFeature; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature.set_Value(feature.Fields.FindField("point_x"), (i = i + 1)); &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 20:28:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243354#M6312</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-04-22T20:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent OnChangeFeature event from firing within itself?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243355#M6313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Boom!&amp;nbsp; That does it, thank you Sean.&amp;nbsp; I didn't even think that IFeature.Store() might not be necessary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Evan.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Make sure you're not calling IFeature.Store in the event as this will re-fire the behavior. Its called internally once the event is complete.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp; public class EditorExtension1 : ESRI.ArcGIS.Desktop.AddIns.Extension
&amp;nbsp; {

&amp;nbsp;&amp;nbsp;&amp;nbsp; private IEditEvents_Event _editEvents;
&amp;nbsp;&amp;nbsp;&amp;nbsp; private int i = 0;

&amp;nbsp;&amp;nbsp;&amp;nbsp; public EditorExtension1()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; protected override void OnStartup()
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IEditor theEditor = ArcMap.Editor;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _editEvents = theEditor as IEditEvents_Event;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _editEvents.OnChangeFeature += new IEditEvents_OnChangeFeatureEventHandler(_editEvents_OnChangeFeature);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp; void _editEvents_OnChangeFeature(ESRI.ArcGIS.Geodatabase.IObject obj)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeature feature = obj as IFeature;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature.set_Value(feature.Fields.FindField("point_x"), (i = i + 1));
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:10:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243355#M6313</guid>
      <dc:creator>EvanBlaisdell</dc:creator>
      <dc:date>2021-12-11T12:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent OnChangeFeature event from firing within itself?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243356#M6314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No problems and sorry its confusing. Its mentioned in the geodatabase &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Creating_features/00010000049v000000/"&gt;concepts help&lt;/A&gt;&lt;SPAN&gt; but i don't think anywhere in editing. I'll see about getting that updated and the individual methods also.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2014 14:50:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/prevent-onchangefeature-event-from-firing-within/m-p/243356#M6314</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-04-23T14:50:33Z</dc:date>
    </item>
  </channel>
</rss>

