<?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: Subtle problem with IEditSketch in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/subtle-problem-with-ieditsketch/m-p/373120#M9795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Sean:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestion, but unfortunately it did not solve the problem.&amp;nbsp; Here is the code that sets up the edit sketch.&amp;nbsp; It's the same for both Tool A and Tool B.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_editSketch = m_editor as IEditSketch2;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_editSketch.GeometryType = esriGeometryType.esriGeometryPolygon;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_editEvents = (IEditEvents_Event)m_editor;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_editEvents.OnSketchFinished += new IEditEvents_OnSketchFinishedEventHandler(m_editEvents_OnSketchFinished);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_editor.CurrentTask = null;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A little more information that might be helpful: if I put a breakpoint on the OnSketchFinished event for tool B, on entry to the event handler the editor and the edit sketch are null items, so the edit sketch geometry is null as well - as if the editor and edit sketch have been consumed by some event handler left over from Tool A.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 17:15:09 GMT</pubDate>
    <dc:creator>StevenHill1</dc:creator>
    <dc:date>2021-12-11T17:15:09Z</dc:date>
    <item>
      <title>Subtle problem with IEditSketch</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/subtle-problem-with-ieditsketch/m-p/373118#M9793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a set of tools (inherited from BaseTool) developed in VS2008 C# for ArcMap 9.3.&amp;nbsp; One of the tools (call it Tool A) uses the editsketch to create a polygon which is then added as a new feature to a feature class (call it feature class A).&amp;nbsp; The edit operation is stopped at that point.&amp;nbsp; Then in another tool (call it Tool B) I again use the edit sketch to draw a polygon which is used to select point features and perform some operations on them (I do this because it is easy to set up the edit sketch geometry and capture the FinishSketch event to get the edit sketch geometry).&amp;nbsp; However, the first time I use the edit sketch in Tool B after creating a feature with Tool A, the polygon that I create to use as a selector is added as a new feature to Feature Class A.&amp;nbsp; It's as if the double click event that finishes the sketch in Tool A is still hooked to the event, even though the editor has been stopped and a (supposedly) new edit sketch has been started.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone have any insight into why this is happening, and maybe a solution?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 00:51:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/subtle-problem-with-ieditsketch/m-p/373118#M9793</guid>
      <dc:creator>StevenHill1</dc:creator>
      <dc:date>2013-04-10T00:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Subtle problem with IEditSketch</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/subtle-problem-with-ieditsketch/m-p/373119#M9794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Steven,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When you activate tool B your edit task may still be set to create feature with the edit target set to layer A.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When you finish the sketch in tool B the editor will do whatever the current task is, using the current sketch geometry.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When you activate tool B you can set the editors current task to null and then do your selection code in the finish sketch event.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;_editor.CurrentTask = null;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Back in tool A, if your creating your own feature and storing it in the finish sketch event, you should set the edit task to null when you activate the tool to prevent the editor from creating two features.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 16:27:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/subtle-problem-with-ieditsketch/m-p/373119#M9794</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-04-10T16:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Subtle problem with IEditSketch</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/subtle-problem-with-ieditsketch/m-p/373120#M9795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Sean:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestion, but unfortunately it did not solve the problem.&amp;nbsp; Here is the code that sets up the edit sketch.&amp;nbsp; It's the same for both Tool A and Tool B.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_editSketch = m_editor as IEditSketch2;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_editSketch.GeometryType = esriGeometryType.esriGeometryPolygon;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_editEvents = (IEditEvents_Event)m_editor;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_editEvents.OnSketchFinished += new IEditEvents_OnSketchFinishedEventHandler(m_editEvents_OnSketchFinished);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_editor.CurrentTask = null;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A little more information that might be helpful: if I put a breakpoint on the OnSketchFinished event for tool B, on entry to the event handler the editor and the edit sketch are null items, so the edit sketch geometry is null as well - as if the editor and edit sketch have been consumed by some event handler left over from Tool A.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:15:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/subtle-problem-with-ieditsketch/m-p/373120#M9795</guid>
      <dc:creator>StevenHill1</dc:creator>
      <dc:date>2021-12-11T17:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Subtle problem with IEditSketch</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/subtle-problem-with-ieditsketch/m-p/373121#M9796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ok. Make sure you are also unsubscribing from the finish sketch event in the tool's deactivate method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;public override bool Deactivate() &amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; // Unsubscribe events &amp;nbsp;&amp;nbsp;&amp;nbsp; m_editEvents.OnSketchFinished -= m_editEvents_OnSketchFinished; &amp;nbsp;&amp;nbsp;&amp;nbsp; return base.Deactivate(); &amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 21:49:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/subtle-problem-with-ieditsketch/m-p/373121#M9796</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-04-10T21:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Subtle problem with IEditSketch</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/subtle-problem-with-ieditsketch/m-p/373122#M9797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks so much for replying Sean, that fixed the problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2013 04:03:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/subtle-problem-with-ieditsketch/m-p/373122#M9797</guid>
      <dc:creator>StevenHill1</dc:creator>
      <dc:date>2013-04-11T04:03:29Z</dc:date>
    </item>
  </channel>
</rss>

