Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Closing Table Window Docking Pane with ITableDocWindowAdmin

$
0
0
Greetings,

I wish to close the table window docking pane via an addin button. I am using Visual C# 2010 Express. The map user will start with one or more attribute tables open (see two_open_attribute_tables.jpg). I am able to close any/all open attribute tables with this code:
//using ESRI.ArcGIS.ArcMapUI;
//using ESRI.ArcGIS.Framework;
//using ESRI.ArcGIS.esriSystem;
//using ESRI.ArcGIS.Carto;

IMxDocument pMxDoc = ArcMap.Document;
IMap pMap = pMxDoc.FocusMap;
IContentsView pTOC = pMxDoc.CurrentContentsView;

IApplication application = ArcMap.Application;
ITableWindow pTableWindow = new TableWindowClass();
pTableWindow.Application = application;
ITableWindow3 pTableWindow3 = pTableWindow as ITableWindow3;

ISet pTableSet = new SetClass();
pTableWindow3.FindOpenTableWindows(out pTableSet);
pTableSet.Reset();
ITableWindow pTableWindowTemp = pTableSet.Next() as ITableWindow;
while (pTableWindowTemp != null)
{
pTableWindowTemp.Show(false);
pTableWindowTemp = pTableSet.Next() as ITableWindow;
}
This, however, leaves me with an open (and empty) table window pane (see no_open_attribute_windows.JPG). The ITableDocWindowAdmin interface has a close method that should close the window pane (http://help.arcgis.com/en/sdk/10.0/a...000016s000000/), but I have been unsuccessful in passing the pTableWindow or pTableWindow3 to that interface (admittedly, I am in way over my head here). I have also attempted to use the IDockableWindowManager to no avail. Here are some of my (failed) approaches:

//A)
//ITableDockWindowAdmin pDockWidowAdmin = new TableDockWindowClass();
//pDockWidowAdmin.SetActiveWindow((ITableWindow)pTableWindow3);
//pDockWidowAdmin.Close((ITableWindow)pTableWindow3);

//B)
//ITableDockWindowAdmin pDockWidowAdmin = application as ITableDockWindowAdmin;
//pDockWidowAdmin.SetActiveWindow((ITableWindow)pTableWindow3);
//pDockWidowAdmin.Close((ITableWindow)pTableWindow3);

//C)
//ITableDockWindowAdmin pDockWidowAdmin = new TableDockWindowClass();//application as ITableDockWindowAdmin;
//ITableWindow pTableWindowToClose = new TableWindowClass();//(ITableWindow)pTableWindow3;
//pTableWindowToClose.Application = application;
//pDockWidowAdmin.Close(pTableWindowToClose);
Any ideas? I have an Esri Incident open, but they have not been able to help.

Thanks!

John
Attached Thumbnails
Click image for larger version

Name:	two_open_attribute_tables.JPG‎
Views:	N/A
Size:	91.3 KB
ID:	22599   Click image for larger version

Name:	no_open_attribute_tables.JPG‎
Views:	N/A
Size:	13.7 KB
ID:	22600  

Viewing all articles
Browse latest Browse all 1374

Trending Articles