3

This question already has an answer here:

I'm working on an add in that generates new structures for an addressing system. The tool is working well, but as it runs, at some point it changes tabs in the Table of Contents to the "List By Source" tab. I'm guessing it does this either when I add temporary tables or shapefiles.

The fact that it changes tabs is not a problem, but I would like for the tool to leave the user in the TOC tab "List By Drawing Order" when it is finished.

Is there any way for a python code to change tabs in the TOC ?

marked as duplicate by PolyGeo Apr 14 '17 at 6:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    It can be done through ArcObjects, but I don't believe you can use arcpy to manipulate the ArcGIS UI. It is possible to call ArcObjects through arcpy with a bit of setup. – Midavalo Mar 8 '17 at 19:21
  • When you add the table(s) it switches to 'List by Source', this is the same if you add the table with the add data button. Does the table really need to be added to ArcMap? You can access it as a Table View without adding it to the TOC. @Midavalo is correct, this is one of those things that can be done in ArcObjects that is not exposed directly to python - you can access it from python with some setup (read gis.stackexchange.com/questions/129456/…) and linked posts for instructions but the tool will not work if not setup first. – Michael Stimson Mar 8 '17 at 21:09
  • I am not purposely adding these tables to ArcMap, but they are automatically added when they are created in the tool's processing. Table View seems like a good option, but when I tried using that approach, the tables were still added to ArcMap when they were created, just now in the Default.gdb instead of the in_memory workspace. Just a clarification - these tables are not appearing in the "List by Drawing Order" tab, but only in the "List By Source" tab. I'm not familiar with ArcObjects, but I'll see what I can manage with them ! – mTy Mar 14 '17 at 20:50