Message 1 of 8
Problem creating a custom commandbar
Not applicable
07-11-2005
12:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to create a custom commandbar in Inventor 10 but I seem to be
stuck. I can create the button definitions and I can create the toolbar but
when I load Inventor the buttons are not being added to the toolbar. I've
used the InteractionTest as a template but no luck.
Source code below. Any ideas?
Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, _
ByVal FirstTime As Boolean)
Dim oIF As IPictureDisp
Dim oIBF As IPictureDisp
Dim oCommandbar As CommandBar
' Save a reference to the Application object.
Set oApp = AddInSiteObject.Application
Set oAppEvents = oApp.ApplicationEvents
Set oIF = LoadResPicture(101, vbResIcon)
Set oIBF = LoadResPicture(111, vbResIcon)
Set oBH_VF =
oApp.CommandManager.ControlDefinitions.AddButtonDefinition("Front", _
"scVF", _
kQueryOnlyCmdType, _
"{57E6E593-2CAE-4016-AE01-74BB752C670E}", _
"Front", _
"Front", _
oIF, _
oIBF, _
kNoTextWithIcon)
oBH_VF.Enabled = True
If FirstTime = True Then
' Create a new toolbar
Set oCommandbar = oApp.UserInterfaceManager.CommandBars.Add("SCV",
"scCBV", kButtonPopupCommandBar, "{57E6E593-2CAE-4016-AE01-74BB752C670E}")
' Add the controls to the command bar.
oCommandbar.Controls.AddButton oBH_VF
' Make the toolbar visible
oCommandbar.Visible = True
End If
End Sub
stuck. I can create the button definitions and I can create the toolbar but
when I load Inventor the buttons are not being added to the toolbar. I've
used the InteractionTest as a template but no luck.
Source code below. Any ideas?
Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, _
ByVal FirstTime As Boolean)
Dim oIF As IPictureDisp
Dim oIBF As IPictureDisp
Dim oCommandbar As CommandBar
' Save a reference to the Application object.
Set oApp = AddInSiteObject.Application
Set oAppEvents = oApp.ApplicationEvents
Set oIF = LoadResPicture(101, vbResIcon)
Set oIBF = LoadResPicture(111, vbResIcon)
Set oBH_VF =
oApp.CommandManager.ControlDefinitions.AddButtonDefinition("Front", _
"scVF", _
kQueryOnlyCmdType, _
"{57E6E593-2CAE-4016-AE01-74BB752C670E}", _
"Front", _
"Front", _
oIF, _
oIBF, _
kNoTextWithIcon)
oBH_VF.Enabled = True
If FirstTime = True Then
' Create a new toolbar
Set oCommandbar = oApp.UserInterfaceManager.CommandBars.Add("SCV",
"scCBV", kButtonPopupCommandBar, "{57E6E593-2CAE-4016-AE01-74BB752C670E}")
' Add the controls to the command bar.
oCommandbar.Controls.AddButton oBH_VF
' Make the toolbar visible
oCommandbar.Visible = True
End If
End Sub