Auto Hide Create Features Window using vb.net

2573
2
Jump to solution
02-08-2012 10:52 AM
NikkiSmith
New Contributor
Hi

I'm trying to auto hide the Create Features window in Arc 10 using .net.

I start editing through code so it doesn't open the create features window automatically so I then have code that opens the Create features window. However, I can't seem to then get it to hide. I had thought that I could access it using Idockablewindow but it doesn't seem to work.

This is my code that opens the Create Features window (this works fine)

Dim pUid As UID = New UID
pUid.Value = "esriEditor.CreateFeatureDockWinCommand" 'Create Features dockable window

Dim pitem As ICommandItem
pitem = g_App.Document.CommandBars.Find(pUid)
pitem.Execute()

Then I run the following bit of code to try and hide the window

        Dim pDockableWindowsManager As IDockableWindowManager = TryCast(g_App, IDockableWindowManager)
        Dim CFWindow As IDockableWindow
        CFWindow = pDockableWindowsManager.GetDockableWindow(pUid)
        If CFWindow Is Nothing Then
            MsgBox("Nothing found")
        Else
            CFWindow.Show(false)
        End If

Problem is that CFWindow is always nothing. I've tried the sample code in the help for IDockableWindow that picks up the TOC and put in the UID for the TOC instead of the create features one and my code works fine with that but it just doesn't work for picking up the create features window.

Any help would be much appreciated, I'm sure it's just something simple I must have missed out but it's driving me mad.

Thanks
Nikki
0 Kudos
1 Solution

Accepted Solutions
AlexanderGray
Occasional Contributor III
Looks like you are trying to use the classId of the CreateFeatureDockWinCommand command to find the CreateFeatureDockWin dockable window...  These are two separate UI elements.   Try using "esriEditor.CreateFeatureDockWin" or "{EA61CE18-4B4F-4767-BA31-A11EC1C63DBB}"  (the GUID for that ClassId)


Dim dockWinUid As UID = New UID dockWinUid .Value = "{EA61CE18-4B4F-4767-BA31-A11EC1C63DBB}" 'Create Features dockable window  Dim pDockableWindowsManager As IDockableWindowManager = TryCast(g_App, IDockableWindowManager) Dim CFWindow As IDockableWindow CFWindow = pDockableWindowsManager.GetDockableWindow(dockWinUid ) If CFWindow Is Nothing Then MsgBox("Nothing found") Else CFWindow.Show(false) End If


You can get all the guids from the registry (almost impossible to sort through) or from categories.exe.  Categories.exe is in the Desktop10.0\bin directory.  In there, turn off hide esri components and go to the appropriate category.  In this case ESRI Mx Dockable Windows.  Mx is for ArcMap, Gx ArcCatalog, Gx globe, Sx Scene.  Then there is Gx Mx which are both ArcCatalog and ArcMap.  In this case create feature is ArcMap only so ESRI Mx Dockable Windows.  Find the item in there, gives the GUI and string.

View solution in original post

0 Kudos
2 Replies
AlexanderGray
Occasional Contributor III
Looks like you are trying to use the classId of the CreateFeatureDockWinCommand command to find the CreateFeatureDockWin dockable window...  These are two separate UI elements.   Try using "esriEditor.CreateFeatureDockWin" or "{EA61CE18-4B4F-4767-BA31-A11EC1C63DBB}"  (the GUID for that ClassId)


Dim dockWinUid As UID = New UID dockWinUid .Value = "{EA61CE18-4B4F-4767-BA31-A11EC1C63DBB}" 'Create Features dockable window  Dim pDockableWindowsManager As IDockableWindowManager = TryCast(g_App, IDockableWindowManager) Dim CFWindow As IDockableWindow CFWindow = pDockableWindowsManager.GetDockableWindow(dockWinUid ) If CFWindow Is Nothing Then MsgBox("Nothing found") Else CFWindow.Show(false) End If


You can get all the guids from the registry (almost impossible to sort through) or from categories.exe.  Categories.exe is in the Desktop10.0\bin directory.  In there, turn off hide esri components and go to the appropriate category.  In this case ESRI Mx Dockable Windows.  Mx is for ArcMap, Gx ArcCatalog, Gx globe, Sx Scene.  Then there is Gx Mx which are both ArcCatalog and ArcMap.  In this case create feature is ArcMap only so ESRI Mx Dockable Windows.  Find the item in there, gives the GUI and string.
0 Kudos
NikkiSmith
New Contributor
Many thanks Alexander - that's brilliant! 🙂

And thanks for the tip about the categories.exe - I hadn't realised that existed so I'm sure that will prove useful in the future.

The window doesn't dock at the side, like the ArcCatalog and Search ones, as I had hoped, just disappears totally but at least I now have a hold of the window so I can play with options which is a massive step in the right direction!!
0 Kudos