<?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 How to enable / disable a tool on the toolbar in ArcObjects? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332953#M8664</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In a typical ArcObjects project in C#, the created toolbar contains 3 or 4 tools.&amp;nbsp; I want set one of the tools disabled in the start.&amp;nbsp; How to do it?&amp;nbsp; Can anyone provide the hint?&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 May 2012 19:32:17 GMT</pubDate>
    <dc:creator>ShaningYu</dc:creator>
    <dc:date>2012-05-22T19:32:17Z</dc:date>
    <item>
      <title>How to enable / disable a tool on the toolbar in ArcObjects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332953#M8664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In a typical ArcObjects project in C#, the created toolbar contains 3 or 4 tools.&amp;nbsp; I want set one of the tools disabled in the start.&amp;nbsp; How to do it?&amp;nbsp; Can anyone provide the hint?&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 19:32:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332953#M8664</guid>
      <dc:creator>ShaningYu</dc:creator>
      <dc:date>2012-05-22T19:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable / disable a tool on the toolbar in ArcObjects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332954#M8665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you're creating this as part of an Add-in, you have to make a modification to the config.esriaddinx file for each tool. You have to add the tag onDemand="False". See the section on Delay loading in the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Advanced_add_in_concepts/0001000004n7000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;Help&lt;/A&gt;&lt;SPAN&gt; for more information&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;lt;Tool id="myProject_myTool" class="myTool" message="A tool" caption="A tool" tip=A tool" category="My Tools" image="Images\myTool.png" onDemand="false" /&amp;gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In addition, you'll have to add the code in the tool itself to enable it, which would go in the OnUpdate sub&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Public Class myTool
&amp;nbsp;&amp;nbsp;&amp;nbsp; Inherits ESRI.ArcGIS.Desktop.AddIns.Tool

&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub New()

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub

&amp;nbsp;&amp;nbsp;&amp;nbsp; Protected Overrides Sub OnUpdate()

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Enabled = 'your enabling code

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:46:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332954#M8665</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T15:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable / disable a tool on the toolbar in ArcObjects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332955#M8666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your response.&amp;nbsp; I coded in C# rather than in VBA.&amp;nbsp; Do you know how to do it?&amp;nbsp; Thanks again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 19:56:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332955#M8666</guid>
      <dc:creator>ShaningYu</dc:creator>
      <dc:date>2012-05-22T19:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable / disable a tool on the toolbar in ArcObjects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332956#M8667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The code provided by Ken is vb.net not vba, so for a c# add-in it is the same just with a c# syntax&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://www.harding.edu/fmccown/vbnet_csharp_comparison.html" rel="nofollow" target="_blank"&gt;http://www.harding.edu/fmccown/vbnet_csharp_comparison.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if this is a not an add-in and is a tool inheriting basetool, you just have to override the Enabled property of the basetool and put whatever code you need in there as long as it returns true or false.&amp;nbsp; Hint, don't put code too elaborate in the enabled property because it runs basically all the time (ie on mouse move.)&amp;nbsp; If the tools or commands need to talk to notify each other, I suggest adding an extension to the mix and setting and reading values on the extension.&amp;nbsp; There can be more than one instance of a command or tool in arcmap which will lead to confusion over where the value is set.&amp;nbsp; There can only be one extension with the same classid loaded at one time making a unique repository for values that need to be passed around.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 20:17:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332956#M8667</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2012-05-22T20:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable / disable a tool on the toolbar in ArcObjects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332957#M8668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Take a look at this &lt;/SPAN&gt;&lt;A href="http://blogs.esri.com/esri/arcgis/2012/01/20/new-features-for-the-arcgis-discussion-forums/"&gt;example code&lt;/A&gt;&lt;SPAN&gt; for a C# implementation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I notice that you post many questions, but do not mark the post that have answered your questions. By clicking the check mark (instead of using the promote arrow), you help others who are searching the posts to find the questions that have been successfully answered. Please review this &lt;/SPAN&gt;&lt;A href="http://blogs.esri.com/esri/arcgis/2012/01/20/new-features-for-the-arcgis-discussion-forums/"&gt;blog posting&lt;/A&gt;&lt;SPAN&gt; about marking questions as answered.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 12:35:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332957#M8668</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2012-05-23T12:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable / disable a tool on the toolbar in ArcObjects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332958#M8669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi! Ken Buja,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for posting reply. It worked for me. I have been searching for this solution. I tried to use OnUpdate() method, but did not know that I should set onDemand="false" in config file, and that is why my code was not working as expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks once Again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mitesh Patel.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 16:58:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332958#M8669</guid>
      <dc:creator>MiteshPatel</dc:creator>
      <dc:date>2013-10-10T16:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable / disable a tool on the toolbar in ArcObjects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332959#M8670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If you're creating this as part of an Add-in, you have to make a modification to the config.esriaddinx file for each tool. You have to add the tag onDemand="False". See the section on Delay loading in the &lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Advanced_add_in_concepts/0001000004n7000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;Help&lt;/A&gt; for more information&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;lt;Tool id="myProject_myTool" class="myTool" message="A tool" caption="A tool" tip=A tool" category="My Tools" image="Images\myTool.png" onDemand="false" /&amp;gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;In addition, you'll have to add the code in the tool itself to enable it, which would go in the OnUpdate sub&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Public Class myTool
&amp;nbsp;&amp;nbsp;&amp;nbsp; Inherits ESRI.ArcGIS.Desktop.AddIns.Tool

&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub New()

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub

&amp;nbsp;&amp;nbsp;&amp;nbsp; Protected Overrides Sub OnUpdate()

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Enabled = 'your enabling code

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi! Ken Buja,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for posting reply. It worked for me. I have been searching for this solution. I tried to use OnUpdate() method, but did not know that I should set onDemand="false" in config file, and that is why my code was not working as expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks once Again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mitesh Patel.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:46:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332959#M8670</guid>
      <dc:creator>MiteshPatel</dc:creator>
      <dc:date>2021-12-11T15:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable / disable a tool on the toolbar in ArcObjects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332960#M8671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This subject is a little hard to find in the documentation. It's found in the Delay Loading section of &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Advanced_add_in_concepts/0001000004n7000000/"&gt;this topic&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 18:59:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-enable-disable-a-tool-on-the-toolbar-in/m-p/332960#M8671</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2013-10-10T18:59:15Z</dc:date>
    </item>
  </channel>
</rss>

