AnsweredAssumed Answered

How to create a FlyoutGroup with correct FlyoutType = Favorite?

Question asked by John Franklin Rickard on May 22, 2018

Hello community, im new to the solidworks api and do not have a lot of knowledge with commandManager/Group/Tab interfaces, which I am trying to expand (in C#).

 

Here the setup of the project:

We have an SwAddin class connected with solidworks. I Create a FlyoutGroup, set the FlyoutGroup to Favorite. Then I add to the CommandTab my FlyoutGroup via AddCommands(...). This looks similar to this(omitting not relevant function parameters).

FlyoutGroup group = commandManager.CreateFlyoutGroup2(...);
// This next line i have to do via an extension method cause i cannot access .FlyoutType. My Visual Studio says it is a protected Variable?!?
group.FlyoutType = (int)swCommandFlyoutStyle_e.swCommandFlyoutStyle_Favorite;

// later on in the code...
var commandIds = new int[] { group.CmdID };
var displayStyles = new int[] { (int)swCommandTabButtonTextDisplay_e.swCommandTabButton_TextBelow 
| (int)swCommandTabButtonFlyoutStyle_e.swCommandTabButton_ActionFlyout };

tabBox = commandTab.AddCommandTabBox();
success = tabBox.AddCommands(commandIds, displayStyles);
//... and so onswComma

 

 

 

The problem i have is that the flyoutgroup correctly displays the first subgroup (as a button with the correct logo and a flyout arrow below), but when i click onto the Button of the FlyoutGroup(not the arrow) the callback function is not called. If i press the arrow below the FlyoutGroup FIRST, it activates something internal and THEN i can click the FlyoutGroup Button and it performs the first SubGroup action.

So my Question: Why does the Flygroup main Button(above the arrow) not call the Callback function when i start my Addin application. Do Flyoutgroups usually get constructed in another way, am i doing something wrong?

 

PS.: Another question maybe helping me with the problem: When i set a normal added button of the command Group via the displaystyles to the same as shown above (with ActionFlyout) It looks exactly like the Button i want to have (and of course calls the correct function from the beginning of the program). But is there a way to somehow get a FlyoutGroup ONTO an existing button? Or can i somehow adjust the FlyoutGroup below the normal Button which I just declared ActionFlyout, even if it is not one?

 

Help would be really appreciated!

Outcomes