Unable to get Ribbon Tab Added by an Add-In

Unable to get Ribbon Tab Added by an Add-In

Anonymous
Not applicable
820 Views
6 Replies
Message 1 of 7

Unable to get Ribbon Tab Added by an Add-In

Anonymous
Not applicable
I have added a ribbon tab in one of my Add-Ins with a panel and a button on it and is working good. When I tried to add a panel to the above mentioned tab it gives an error at the point of accessing the existing tab. Is there any solution to load the first add-in before loading the second one?

The code used to add the first tab is
{code}
'Get the tabs associated with ZeroDoc ribbon & add new tab IP Tooling
Dim ribbonTabs As RibbonTabs = zeroDocRibbon.RibbonTabs
Dim toolingRibbonTab As RibbonTab = ribbonTabs.Add("IP Tooling ", "id_Tab_IPTooling", m_addInCLSIDSting, , , )
{code}

and the code on second Addin to access the existing tab is
{code}
strError = "unable to locate zero doc tooling tab"
Dim zeroDocTab As RibbonTab = ZerodocRibbon.RibbonTabs("id_Tab_IPTooling")
{code}

need help to overcome this issue

Thanks & Regards,
Saseendran Kombath
Interplast Co. Ltd.,
UAE
0 Likes
821 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
What you want is a function that doesn't care if a ribbon's been created yet or not.

{code}
Private Function AddRibbonTab(ByVal objEnvironment As Environment, ByVal strDisplayName As String, ByVal strInternalName As String, ByVal strCLSID As String) As RibbonTab
Dim objRibbonTab As RibbonTab = Nothing
Try
Try
objRibbonTab = objEnvironment.Ribbon.RibbonTabs.Add(strDisplayName, strInternalName, strCLSID)
Catch ex As Exception
objRibbonTab = objEnvironment.Ribbon.RibbonTabs.Item(strInternalName)
End Try
Catch ex As Exception
HandleException(ex)
End Try
Return objRibbonTab
End Function
Private Function AddRibbonPanel(ByVal objRibbonTab As RibbonTab, ByVal strDisplayName As String, ByVal strInternalName As String, ByVal strCLSID As String) As RibbonPanel
Dim objRibbonPanel As RibbonPanel = Nothing
Try
Try
objRibbonPanel = objRibbonTab.RibbonPanels.Add(strDisplayName, strInternalName, strCLSID)
Catch ex As Exception
objRibbonPanel = objRibbonTab.RibbonPanels.Item(strInternalName)
End Try
Catch ex As Exception
HandleException(ex)
End Try
Return objRibbonPanel
End Function
{code}

These first try and add the ribbon, and if doing so throws an exception, then likely it already existed, so it'll try and return that instead. If that lookup fails, then you've got a bigger problem.
0 Likes
Message 3 of 7

Anonymous
Not applicable
This is to check the ribbon is loaded or not, my question is the add ribbon is given in the first add-in is inside first time section. And that add-in is working good. And when the second Add-in try to locate the old ribbon, it shows the ribbon is not present. That means the first add-in is not loaded before the second one. I want to know how can I check the first add-in is loaded if not load that first (before second add-in)

Thanks & Regards,
Saseendran Kombath
Interplast Co. Ltd.,
UAE
0 Likes
Message 4 of 7

Anonymous
Not applicable
Add-Ins are loaded in what is essentially a random order. However, it's not
actually random but is based on the client ID of the addin. They're loaded
in order of their ID, but since the ID's are generated randomly this results
in a somewhat random order. You can take advantage of this though in the
case where you are dependent on another add-in and just make sure that the
ID for your add-in is higher.
--
Brian Ekins
Autodesk Inventor API Product Designer
http://blogs.autodesk.com/modthemachine
0 Likes
Message 5 of 7

Anonymous
Not applicable
Thanks Brian.
This is what I was looking for, on what basis the Add-in Loading order


Thanks & Regards,
Saseendran Kombath
Interplast Co. Ltd.,
UAE
0 Likes
Message 6 of 7

Anonymous
Not applicable
What is HandleException"
0 Likes
Message 7 of 7

Anonymous
Not applicable
It's just a generic function for handling exceptions. I usually have it write the error info to a text file, but you can also pop up a message box or something if you wanted.
0 Likes