You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - ArcObjects Visual Basic for Application (VBA) forum

How do I specify the position of toolbars w...   Mark Hudson Sep 28, 2004
Re: How do I specify the position of toolba...   Waleed Effat Sep 28, 2004
Re: How do I specify the position of toolba...   Mark Hudson Sep 29, 2004
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject How do I specify the position of toolbars when docking them programmatically? 
Author Mark Hudson 
Date Sep 28, 2004 
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
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How do I specify the position of toolbars when docking them programmatically? 
Author Waleed Effat 
Date Sep 28, 2004 
Message Hi,

Do not use esriDockShow only, you could use esriDockLeft, esriDockRight. etc. just to specify the location of your toolbar.

hope it helps, 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How do I specify the position of toolbars when docking them programmatically? 
Author Mark Hudson 
Date Sep 29, 2004 
Message Hi Karim:

I've tried using esriDockLeft, etc; but it doesn't give me what I want. Instead of the toolbar docking at the far left of the application (ie, to the left of the table of contents), I want it to dock on the left side of the map view (ie, on the right edge of the table of contents). In addition I have a toolbar to replace the standard toolbar, and would like it to dock in the same place where the standard toolbar appears (ie, under the menus), but I cannot figure out how to place it there either.

Any ideas on how to do this?