Layer activation MessageBox in 10.1

673
1
10-22-2012 03:04 AM
JamesBrown1
New Contributor
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.

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?

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.

Any suggestions or similar experiences would be greatly appreciated.

Cheers,
James
Tags (2)
0 Kudos
1 Reply
AndrewChapkowski
Esri Regular Contributor
James,

At 10.1, you can create message boxes using Python-Addins and the pythonaddin module.

Check out: http://resources.arcgis.com/en/help/main/10.1/index.html#//014p00000025000000

I think a python extension might meet your needs.  Just pick the correct event to listen to, and place your logic under that event.
It sounds like the event itemReordered(self, reordered_item, new_index) might be what you are looking for.

... class init and stuff
def itemReordered(self, reordered_item, new_index):
   pythonaddins.MessageBox('layer moved', 'INFO', 0)


Hope this helps.
0 Kudos