Detect Current Ribbon Tab

Detect Current Ribbon Tab

Dale.Bartlett
Collaborator Collaborator
2,026 Views
3 Replies
Message 1 of 4

Detect Current Ribbon Tab

Dale.Bartlett
Collaborator
Collaborator

All, This may be covered somewhere, but I couldn't find anything. I have a two ribbon tabs (one is a beta/test area). Sometimes I have exactly the same panel/buttons on both tabs; this is deliberate. When I execute a button push I would like to know which tab is active at the time to set some defaults in the called function. Ideas? Links? Thanks, Dale   




______________
Yes, I'm Satoshi.
0 Likes
Accepted solutions (1)
2,027 Views
3 Replies
Replies (3)
Message 2 of 4

Dale.Bartlett
Collaborator
Collaborator
Accepted solution

Ok, I used this:

Autodesk.Windows.RibbonControl r = Autodesk.Windows.ComponentManager.Ribbon;
foreach (Autodesk.Windows.RibbonTab t in r.Tabs)
{
   if (t.IsActive)
       MessageBox.Show("Tab Name = " + t.Name);
}

Unless there is a better idea, that will do. Thanks, Dale




______________
Yes, I'm Satoshi.
Message 3 of 4

jeremytammik
Autodesk
Autodesk

Dear Dale,

 

Thank you for your query and solution.

 

It looks perfect to me, and I am not aware of any other sensible approach.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 4 of 4

p_smithBVN
Participant
Participant

Hi @Dale.Bartlett,

 

I am trying to adopt a similar setup for a custom addin suite we have. However the Beta version has trouble OnStartup, returning the below exception.

 

p_smithBVN_0-1649296951446.png

I understand what it's telling me but I can change the name of that Beta build tab to anything and it still throws the same exception. Furthermore, I can dismiss that exception and then open up Dynamo/Python/sharpDevelop and manually create the tab with any of the names that have failed and they create fine.

 

I was wondering if this was something you encountered at all? I have segregated all the underlying assembly information between the release & Beta versions, because it's the one VS solution but just getting copied to different locations in post build events depending on config, but that hasn't helped either.

 

Cheers, Pete

0 Likes