<?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 IMap value is invalid in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/imap-value-is-invalid/m-p/182559#M4736</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0 0 1em; font-size: 14.4444446563721px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;Why ArcMap.Application.Document is null on run? There is my addin. It consist of tool and docWindow. DocWindow opens when tool is selected. When I run ArcMap with selected myTool and opened window, ArcMap.Application.Document is null.&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 14.4444446563721px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;If I call this from DockPanelClass (or other class) :&lt;/P&gt;&lt;PRE class="prettyprint prettyprinted lang-cs" style="margin: 0 0 10px; padding: 5px; font-size: 12px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; color: #393318; background-color: #eeeeee;"&gt;&lt;CODE style="font-size: 12.222222328186px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; color: #222222;"&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;IMxDocument&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; doc &lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;ArcMap&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;Application&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;Document&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="font-size: 12.222222328186px; color: #8a4a0b;"&gt;as&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;IMxDocument&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;IMap&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;map&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; doc&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;FocusMap&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="margin: 0 0 1em; font-size: 14.4444446563721px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;map contains 0 layers;&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 14.4444446563721px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;But when I call it from MyToolClass it becomes valid and contains all my map layers. What happens?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 Oct 2014 10:44:02 GMT</pubDate>
    <dc:creator>SergeyGamayunov</dc:creator>
    <dc:date>2014-10-31T10:44:02Z</dc:date>
    <item>
      <title>IMap value is invalid</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/imap-value-is-invalid/m-p/182559#M4736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0 0 1em; font-size: 14.4444446563721px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;Why ArcMap.Application.Document is null on run? There is my addin. It consist of tool and docWindow. DocWindow opens when tool is selected. When I run ArcMap with selected myTool and opened window, ArcMap.Application.Document is null.&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 14.4444446563721px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;If I call this from DockPanelClass (or other class) :&lt;/P&gt;&lt;PRE class="prettyprint prettyprinted lang-cs" style="margin: 0 0 10px; padding: 5px; font-size: 12px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; color: #393318; background-color: #eeeeee;"&gt;&lt;CODE style="font-size: 12.222222328186px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; color: #222222;"&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;IMxDocument&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; doc &lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;ArcMap&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;Application&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;Document&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="font-size: 12.222222328186px; color: #8a4a0b;"&gt;as&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;IMxDocument&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;IMap&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;map&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="font-size: 12.222222328186px; color: #000000;"&gt; doc&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="font-size: 12.222222328186px; color: #2b91af;"&gt;FocusMap&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-size: 12.222222328186px; color: #145680;"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="margin: 0 0 1em; font-size: 14.4444446563721px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;map contains 0 layers;&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 14.4444446563721px; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;But when I call it from MyToolClass it becomes valid and contains all my map layers. What happens?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2014 10:44:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/imap-value-is-invalid/m-p/182559#M4736</guid>
      <dc:creator>SergeyGamayunov</dc:creator>
      <dc:date>2014-10-31T10:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: IMap value is invalid</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/imap-value-is-invalid/m-p/182560#M4737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FocusMap is one of the last things to get populated as a map document is loaded.&amp;nbsp; At what point is your code being called?&amp;nbsp; &lt;/P&gt;&lt;P&gt;If your tool is listening to document events you would want to get a reference to the map after IDocumentEvents.OpenDocument and/or IActiveViewEvents.FocusMapChanged have fired.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you don't need the reference to FocusMap until the tool is being used anyway, there's nothing wrong with calling it from your MyToolClass as you have already done.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Dec 2014 17:09:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/imap-value-is-invalid/m-p/182560#M4737</guid>
      <dc:creator>JeffMatson</dc:creator>
      <dc:date>2014-12-30T17:09:40Z</dc:date>
    </item>
  </channel>
</rss>

