<?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 Layer activation MessageBox in 10.1 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/layer-activation-messagebox-in-10-1/m-p/29594#M2294</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to create a warning message box for when users switch a layer on in the ToC. The message box is very simple with only an ???OK??? button which the user must click to confirm the warning has been read. Once accepted the layer displays as normal. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In 9.3 we were able to achieve this using VBA. What is the process to achieve this in a 10.1 map document now that VBA is not supported? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I realise the solution is likely to involve Python. Would the process be to create a Python script in a new toolbox? This script would need to run constantly to check for when the layer is switched on so would need to be called upon differently to a standard geoprocessing tool which is ordinarily only used at one time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions or similar experiences would be greatly appreciated. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Oct 2012 10:04:04 GMT</pubDate>
    <dc:creator>JamesBrown1</dc:creator>
    <dc:date>2012-10-22T10:04:04Z</dc:date>
    <item>
      <title>Layer activation MessageBox in 10.1</title>
      <link>https://community.esri.com/t5/python-questions/layer-activation-messagebox-in-10-1/m-p/29594#M2294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to create a warning message box for when users switch a layer on in the ToC. The message box is very simple with only an ???OK??? button which the user must click to confirm the warning has been read. Once accepted the layer displays as normal. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In 9.3 we were able to achieve this using VBA. What is the process to achieve this in a 10.1 map document now that VBA is not supported? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I realise the solution is likely to involve Python. Would the process be to create a Python script in a new toolbox? This script would need to run constantly to check for when the layer is switched on so would need to be called upon differently to a standard geoprocessing tool which is ordinarily only used at one time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions or similar experiences would be greatly appreciated. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2012 10:04:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-activation-messagebox-in-10-1/m-p/29594#M2294</guid>
      <dc:creator>JamesBrown1</dc:creator>
      <dc:date>2012-10-22T10:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Layer activation MessageBox in 10.1</title>
      <link>https://community.esri.com/t5/python-questions/layer-activation-messagebox-in-10-1/m-p/29595#M2295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;James,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At 10.1, you can create message boxes using Python-Addins and the pythonaddin module.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Check out: &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//014p00000025000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//014p00000025000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think a python extension might meet your needs.&amp;nbsp; Just pick the correct event to listen to, and place your logic under that event.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It sounds like the event itemReordered(self, reordered_item, new_index) might be what you are looking for. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
... class init and stuff
def itemReordered(self, reordered_item, new_index):
&amp;nbsp;&amp;nbsp; pythonaddins.MessageBox('layer moved', 'INFO', 0)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:11:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/layer-activation-messagebox-in-10-1/m-p/29595#M2295</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2021-12-10T21:11:30Z</dc:date>
    </item>
  </channel>
</rss>

