<?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: How to disabled Command in .NET?? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-disabled-command-in-net/m-p/455344#M12355</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I assume you mean you've created a class implementing the ICommand interface.&amp;nbsp; If so, you need to put your enable/disable logic in the ICommand::Enabled method.&amp;nbsp; Return true to enable the command and false to disable it.&amp;nbsp; You'll need something like the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pActiveView as IActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pActiveView = pMxDoc.ActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If Typeof pActiveView Is IMap Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ' Map object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; return true&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ' PageLayout object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; return false&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Aug 2010 07:49:46 GMT</pubDate>
    <dc:creator>AndrewMay</dc:creator>
    <dc:date>2010-08-19T07:49:46Z</dc:date>
    <item>
      <title>How to disabled Command in .NET??</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-disabled-command-in-net/m-p/455343#M12354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hi i create base map command in .NET, but command is still enabled? How can I disabled it when PageLayout is active and enable it when MapView is active? ...thaks a lot.. Martin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 07:10:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-disabled-command-in-net/m-p/455343#M12354</guid>
      <dc:creator>martinmaretta</dc:creator>
      <dc:date>2010-08-19T07:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to disabled Command in .NET??</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-disabled-command-in-net/m-p/455344#M12355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I assume you mean you've created a class implementing the ICommand interface.&amp;nbsp; If so, you need to put your enable/disable logic in the ICommand::Enabled method.&amp;nbsp; Return true to enable the command and false to disable it.&amp;nbsp; You'll need something like the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pActiveView as IActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pActiveView = pMxDoc.ActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If Typeof pActiveView Is IMap Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ' Map object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; return true&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; ' PageLayout object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; return false&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 07:49:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-disabled-command-in-net/m-p/455344#M12355</guid>
      <dc:creator>AndrewMay</dc:creator>
      <dc:date>2010-08-19T07:49:46Z</dc:date>
    </item>
  </channel>
</rss>

