<?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: Why is my custom button grayed out? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/why-is-my-custom-button-grayed-out/m-p/628842#M16944</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Brian,&lt;/P&gt;&lt;P&gt;You'll need to add&amp;nbsp;onDemand="false" to your controls definition in the config.esriaddinx file.&lt;/P&gt;&lt;P&gt;This loads the code behind the tool when the tool is instantiated rather than when its clicked on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 May 2020 16:41:27 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2020-05-15T16:41:27Z</dc:date>
    <item>
      <title>Why is my custom button grayed out?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/why-is-my-custom-button-grayed-out/m-p/628841#M16943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've created many custom tools in ArcMap, with most of them using the fuctionality where they are grayed out until the user starts an edit session.&amp;nbsp; The code I have always used is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;public&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;class&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;ToFromTool_AddIn&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; ESRI&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGIS&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Desktop&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddIns&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Button
    &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;private&lt;/SPAN&gt; ESRI&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGIS&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;esriSystem&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UID editorUID &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;ESRI&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGIS&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;esriSystem&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UIDClass&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;private&lt;/SPAN&gt; ESRI&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGIS&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Editor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;IEditor3 m_editor&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

        &lt;SPAN class="keyword token"&gt;protected&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;override&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;OnUpdate&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
            Enabled &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; m_editor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;EditState &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; esriEditState&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;esriStateNotEditing&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's been a while since I've created a new ArcMap tool, but for some reason the new tool I have created will not activate when I start an edit session.&amp;nbsp; There must be something I have missed, but I cannot figure it out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas of what I need to check??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:46:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/why-is-my-custom-button-grayed-out/m-p/628841#M16943</guid>
      <dc:creator>BrianBulla</dc:creator>
      <dc:date>2021-12-12T02:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my custom button grayed out?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/why-is-my-custom-button-grayed-out/m-p/628842#M16944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Brian,&lt;/P&gt;&lt;P&gt;You'll need to add&amp;nbsp;onDemand="false" to your controls definition in the config.esriaddinx file.&lt;/P&gt;&lt;P&gt;This loads the code behind the tool when the tool is instantiated rather than when its clicked on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2020 16:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/why-is-my-custom-button-grayed-out/m-p/628842#M16944</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-05-15T16:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my custom button grayed out?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/why-is-my-custom-button-grayed-out/m-p/628843#M16945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sean,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I had onDemand = false.&amp;nbsp; What I was doing was recreating a tool that already existed.&amp;nbsp; So it had a new GUID and version #, yet everything else was the same to facilitate easily copy/pasting code from one to the other.&amp;nbsp; In the end what fixed it was deleting the original .esriAddIn file and replacing it with the new one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My setup for testing was to load the original tool through a network path, and then load the new tool through the local AddIns folder as I was testing it with VisualStudio.&amp;nbsp; Both tools were appearing in the toolbar, but only the original was working properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure why I had to delete the original one to finally get things working, but it is all working now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2020 14:15:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/why-is-my-custom-button-grayed-out/m-p/628843#M16945</guid>
      <dc:creator>BrianBulla</dc:creator>
      <dc:date>2020-05-19T14:15:04Z</dc:date>
    </item>
  </channel>
</rss>

