| Message |
Hi all:
I have a customized ArcMap application in which I want to specify what toolbars are visible when the application is opened. I've figured out how to do this, however I can't seem to dock them in a specific location. I know I can use the esriDockFlags constants to put them in pre-defined locations, but I want to dock them in specific locations (eg. bordering the right edge of the table of contents). I've attached my code below where I try to use the referenceBar parameter with the Dock method on the ICommandBar interface. This does not work, and just displays the toolbar in the middle of the map view.
My code is below, please ignore the other subs I am calling - they are working fine. In the example below I'm trying to reference the location of the standard toolbar. This code is not docking my custom toolbar in the same location as the standard toolbar. Any ideas on how to get this to work?
Thanks,
Mark Hudson
GIS Resource Analyst
Newfoundland Forest Service
Corner Brook, NL |
| |
Private Function MxDocument_CloseDocument() As Boolean
Call MakeFieldsVisible
'***********************************************
'make those fields editable again:
'Call FieldsEditable(State)
Dim pCommandBars As ICommandBars
Set pCommandBars = ThisDocument.CommandBars
pCommandBars.HideAllToolbars
Dim pCommandBar1 As ICommandBar
Dim pCommandBar2 As ICommandBar
Set pCommandBar1 = pCommandBars.Find(arcid.Standard_Toolbar, False, False)
Set pCommandBar2 = pCommandBars.Find(arcid.Tools_Toolbar, False, False)
pCommandBar1.Dock esriDockShow
pCommandBar2.Dock esriDockShow
End Function
'When the document opens, make all fields visible becuase they may not have been
'from the last time the program was run:
Private Function MxDocument_OpenDocument() As Boolean
Call MakeFieldsVisible
Dim pCommandBars As ICommandBars
Set pCommandBars = ThisDocument.CommandBars
pCommandBars.HideAllToolbars
Dim pCommandBar1 As ICommandBar
Dim pCommandBar2 As ICommandBar
Dim pCommandBar3 As ICommandBar
Dim pCommandBarRef1 As ICommandBar
Set pCommandBar1 = pCommandBars.Find("Project.Select Stands to Update", False)
Set pCommandBar2 = pCommandBars.Find("Project.Set Harvest Period", False)
Set pCommandBar3 = pCommandBars.Find("Project.Standard2", False)
Set pCommandBarRef1 = pCommandBars.Find(arcid.Standard_Toolbar, False)
pCommandBar1.Dock esriDockShow
pCommandBar2.Dock esriDockShow
pCommandBar3.Dock esriDockShow, pCommandBarRef1
'***********************************************
'make certain fields not editable:
'Call FieldsEditable(State)
End Function |