Here is an example of adding toolbuttons a new toolbar and the assembly
panel bar. The following code is in the ApplicationAddInServer_Activate
procedure. (watch for word wrap)
- Note that the images in this code are loaded from a resourse file.
- A public constant has been declared: kErrorDebugMode = -2147418113
- The error handler enables text display in place of the icons when
debugging the add-in.
Dim oIcon1 As IPictureDisp
Dim oIcon2 As IPictureDisp
Set oIcon1 = LoadResPicture(102, vbResIcon)
Set oIcon2 = LoadResPicture(103, vbResIcon)
'get a reference to the IV application object
Set m_oIVApp = AddInSiteObject.Application
On Error Resume Next
Set oButtonHandler1 =
AddInSiteObject.CreateButtonDefinitionHandler("AnimatorV4Cmd1", _
kFileOperationsCmdType, "Animate", "Animator 4", "Animate", oIcon1,
oIcon2)
If Err.Number = kErrorDebugMode Then
Set oButtonHandler1 = Nothing
Set oButtonHandler1 =
AddInSiteObject.CreateButtonDefinitionHandler("AnimatorV4Cmd1", _
kFileOperationsCmdType, "Animate", "Animator 4", "Animate")
Err.Clear
On Error GoTo 0
End If
'set a reference to the environment base collection
Dim oEnvBaseColl As EnvironmentBaseCollection
Set oEnvBaseColl = m_oIVApp.EnvironmentBaseCollection
'create a new command bar
Dim oCommandBar As CommandBarBase
Set oCommandBar = oEnvBaseColl.CommandBarBaseCollection.Add("Animator")
'add a button to the new command bar
Call oCommandBar.Controls.Add(kBarControlButton,
oButtonHandler1.ControlDefinition)
'get a reference to the assembly panel bar
Dim oAsmCommandBar As CommandBarBase
Set oAsmCommandBar =
oEnvBaseColl.CommandBarBaseCollection.Item("AMxAssemblyPanelCmdBar")
'add a button to the Assembly panel bar
Call oAsmCommandBar.Controls.Add(kBarControlButton,
oButtonHandler1.ControlDefinition)
Hope this helps some,
Neil
"Frank Oquendo" wrote in message
news:EE6433BABDE26E9CDDD161DABBB69C8F@in.WebX.maYIadrTaRb...
> Kent Keller wrote:
> > I guess I am not following. In my mind the Assembly Panel is a
> > toolbar..... i.e. go to customize, Toolbars, select Assembly Panel
> > and "Show"
>
> While you can add your own panels to a given environment, MDB is wanting
> to add a buton to an existing panel (i.e. "Assembly Panel", "Tube &
> Pipe"). I do not think this is possible but would love to be proven
> wrong.
>
> --
> There are 10 kinds of people. Those who understand binary and those who
> don't.
>
> http://code.acadx.com
> (Pull the pin to reply)
>
>