- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I know I'm close, but can't seem to figure out what I'm missing.
I've got a custom ribbon tab (Inspection) that shows when a Drawing is active.
However, I have a few docked windows that need to be associated with the inspection tab. When it's active they show up, when it's not they disappear.
I used Philippe's example to create a hook on the "ZeroDoc" environment, but when the event handler is called, the custom tab is not yet visible. When the custom tab is visible the component manager has already been initialized. I tried setting the addhandler when I loaded the custom tab, but it would seem as though the "activated" handle is not available.
Here is the sample code which fails because the "RibbonTab" is not the same object as the "Ribbons.item" that is used to create the tab, but I'm not sure how else to go about it.
Private Sub AddToUserInterface() ' This is where you'll add code to add buttons to the ribbon. ' Get the part ribbon. Dim partRibbon As Ribbon = g_inventorApplication.UserInterfaceManager.Ribbons.Item("Drawing") Dim InspectionTab As Inventor.RibbonTab ' Get the "Inspection" tab. InspectionTab = partRibbon.RibbonTabs.Add("Inspection", "TAB_Inspection", Guid.NewGuid().ToString) For Each Tab As Autodesk.Windows.RibbonTab In Autodesk.Windows.ComponentManager.Ribbon.Tabs If (Tab.Id = "id_Inspection") Then AddHandler Tab.Activated, AddressOf Me.Tab_Activated End If Next ' Create a new panel. Dim AddNew As Inventor.RibbonPanel = InspectionTab.RibbonPanels.Add("Add New", "Insp_Add_New", Guid.NewGuid().ToString) ' Add a button. AddNew.CommandControls.AddButton(m_AddNew, True, True) End Sub
Solved! Go to Solution.