<?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 If Not Data View Then??? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/if-not-data-view-then/m-p/649974#M17434</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I???ve build a few ArcMap Add-ins and they work fine, when running in the Data View mode.&amp;nbsp; But, if I???m in the Layout View and I start the Add-Ins, ArcMap crashes. Is there a way to get a message, instead of a crash, when the user is not in Data View?&amp;nbsp; Or, is there a way to have an Add-In to work in both Data View and Layout view?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Jun 2012 11:14:11 GMT</pubDate>
    <dc:creator>DaveCouture</dc:creator>
    <dc:date>2012-06-27T11:14:11Z</dc:date>
    <item>
      <title>If Not Data View Then???</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/if-not-data-view-then/m-p/649974#M17434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I???ve build a few ArcMap Add-ins and they work fine, when running in the Data View mode.&amp;nbsp; But, if I???m in the Layout View and I start the Add-Ins, ArcMap crashes. Is there a way to get a message, instead of a crash, when the user is not in Data View?&amp;nbsp; Or, is there a way to have an Add-In to work in both Data View and Layout view?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2012 11:14:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/if-not-data-view-then/m-p/649974#M17434</guid>
      <dc:creator>DaveCouture</dc:creator>
      <dc:date>2012-06-27T11:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: If Not Data View Then�?�</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/if-not-data-view-then/m-p/649975#M17435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It depends on what your addins do.&amp;nbsp; First of all, make sure you're getting your references correctly.&amp;nbsp; For instance, if you want to do something like add elements to the graphics container then don't get the graphics container reference from something like IMxDocument.ActiveView.&amp;nbsp; The ActiveView property returns a map while in Data view and a page layout while in Layout view.&amp;nbsp; Also, you can simply disable your addin while in the incorrect view.&amp;nbsp; If it only works in Data view then check IMxDocument.ActiveView to see if it is a page layout and disable your addin if it is.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2012 12:19:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/if-not-data-view-then/m-p/649975#M17435</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2012-06-27T12:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: If Not Data View Then�?�</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/if-not-data-view-then/m-p/649976#M17436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Neil, that make sense.&amp;nbsp; I like the option to have the tool disabled (button grey out), when in Layout VIew. I'm just unsure how to build the condition to check if the Layout View is on, tho.&amp;nbsp; I've been reading on the IActiveView and IMxDocument, but I can't find solutions on how to determine which view is activated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I use in my code, to set the Active View:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Dim pMap As IMap = My.ArcMap.Document.ActiveView
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:33:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/if-not-data-view-then/m-p/649976#M17436</guid>
      <dc:creator>DaveCouture</dc:creator>
      <dc:date>2021-12-12T03:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: If Not Data View Then�?�</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/if-not-data-view-then/m-p/649977#M17437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The document's active view will be either a map or a page layout so all you should need to do is check the type.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;If TypeOf My.ArcMap.Document.ActiveView Is IMap Then &amp;nbsp; ' document is in Data view ElseIf TypeOf My.ArcMap.Document.ActiveView Is IPageLayout Then &amp;nbsp; ' document is in Layout view End If&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't work with addins, but for a standard ICommand implementation it would look like the code below.&amp;nbsp; There should be something similar for an addin.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Public ReadOnly Property Enabled() As Boolean Implements ESRI.ArcGIS.SystemUI.ICommand.Enabled &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim mxDocument As IMxDocument = DirectCast(m_application.Document, IMxDocument)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Enabled as long as the document is in Data view. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return (TypeOf mxDocument.ActiveView Is IMap) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Get &amp;nbsp;&amp;nbsp;&amp;nbsp; End Property&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2012 12:52:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/if-not-data-view-then/m-p/649977#M17437</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2012-06-27T12:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: If Not Data View Then�?�</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/if-not-data-view-then/m-p/649978#M17438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a bunch, Neil!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2012 13:06:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/if-not-data-view-then/m-p/649978#M17438</guid>
      <dc:creator>DaveCouture</dc:creator>
      <dc:date>2012-06-27T13:06:50Z</dc:date>
    </item>
  </channel>
</rss>

