Hi all!
I have a ribbon panel editor to show/hide ribbon tabs within an in-house addin, we have lots of other paid tools and the ribbon is really ful. I noticed I'd have duplicate version for the family based panels in a regular window.
To remove the duplicates I did:
if (!ribbonCheckboxList.Items.Contains(tab.Title))
{
ribbonCheckboxList.Items.Add(tab.Title);
}
When this list is built, the duplicates are removed, however the effect is present on both with the same name, as I do the following:
string CurrentlySelectedTab = (string)ribbonCheckboxList.Items[e.Index];
if (sdsstring != CurrentlySelectedTab.ToLower())
{
foreach (RibbonTab tab in Autodesk.Windows.ComponentManager.Ribbon.Tabs)
{
Debug.WriteLine(tab.Title);
if ((CurrentlySelectedTab == tab.Title) && (e.CurrentValue == CheckState.Checked))
{
tab.IsVisible = false;
}
if ((CurrentlySelectedTab == tab.Title) && (e.CurrentValue == CheckState.Unchecked))
{
tab.IsVisible = true;
}
}
}
A simple on or off when clicked and everything works.
Now as it searches for Title, both panels are added or removed, resulting in this, duplicate versions. This is my error I'd like to fix:
Is there a way of detecting the family versions of the panels or should I be storing the tab.UID property instead? Obviously this would assume the first iteration of the "Annotate" panel is the "normal" one correct? I'd prefer to have a detection for family based as this would require it working in the family version as well.
Solved! Go to Solution.
Solved by ricaun. Go to Solution.
I do not know if there is an answer to this besides making your in-house custom panel names unique. You could prepend your company initials or in some other way?
The duplicates are of official autodesk ribbon tabs, except they are the ones that appear when in a family model. They are normally hidden based on the type of model open, however as I am searching by Title property, the issue of these becoming duplicates occours. Its doesn't have anything to do with the number of addins.
I think I might build a test version with the UID property, export to JSON to read back and fourth from.
If anyone else has any better ideas do comment them!
One last question, you obviously researched a lot here. Does tab have an id property that could be used?
Can't find what you're looking for? Ask the community or share your knowledge.