AddButtonPopup versus AddSplitButtonMRU

AddButtonPopup versus AddSplitButtonMRU

rjay75
Advisor Advisor
1,464 Views
10 Replies
Message 1 of 11

AddButtonPopup versus AddSplitButtonMRU

rjay75
Advisor
Advisor

What is the difference between AddButtonPopup and AddSplitButtonMRU.

 

According to the documentation AddButtonPopup should create a button control similar to the View Type button? In 2014 it seems to just add another SplitButtonMRU. If it is different how is the display name set and how is the descriptions shown in the button dropdown?

 

 

0 Likes
Accepted solutions (2)
1,465 Views
10 Replies
Replies (10)
Message 2 of 11

philippe.leefsma
Alumni
Alumni
Accepted solution

Hi

 

The difference is that the popup lets you select an item of the dropdown list every time you click on the button, whereas the MRU keep the Most Recently Used item, so you can use the same command directly without selecting from the dropdown list.

 

You need to add to the MRU or popup existing button definitions or some new that you created, check the API help files for more details: CommandControls.AddSplitButtonMRU Method.

 

Here is an example:

 

CommandControl cmdCtrl = null;

ControlDefinition oCtrlDef1 = m_inventorApplication.CommandManager.ControlDefinitions["AppAddInManagerCmd"];
ControlDefinition oCtrlDef2 = m_inventorApplication.CommandManager.ControlDefinitions["AppVBAEditorCmd"];
ControlDefinition oCtrlDef3 = m_inventorApplication.CommandManager.ControlDefinitions["AppApplicationOptionsCmd"];

cmdCtrl = oPanel.CommandControls.AddButton(mButtonDef as ButtonDefinition, true, true, "", true);

cmdCtrl = oPanel.CommandControls.AddComboBox(mComboDef, cmdCtrl.InternalName, false);

ObjectCollection collec =
    m_inventorApplication.TransientObjects.CreateObjectCollection(null);

collec.Add(oCtrlDef1);
collec.Add(oCtrlDef2);
collec.Add(oCtrlDef3);

//oPanel.CommandControls.AddButtonPopup(collec, true, true, "", false);

oPanel.CommandControls.AddSeparator("", false);

//!!You can't create a split button that has as its first control 
//that uses an internal name that's the same as another in that panel
oPanel.CommandControls.AddSplitButtonMRU(collec,
    true,
    true,
    cmdCtrl.InternalName,
    false);

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 11

rjay75
Advisor
Advisor

Thanks, for the response. I can see the difference in the behaviors now. On a ButtonPopup how do you set the display name of the displayed control?

 

The documentation mentions the Visual Style control on the ribbon is this type of button. The icon changes to what ever style is selected and it behaves like a ButtonPopup. But the label is different from all the definitions added to the control, in that it stays at Visual Style.

0 Likes
Message 4 of 11

philippe.leefsma
Alumni
Alumni

Read the help files:

 

CommandControls.AddButtonPopup

 

Parameter ButtonDefinitions

 

Input ObjectCollection containing the ButtonDefinition objects hosted by this control. The first ButtonDefinition is used as the displayed control. Also, the internal and display names of the first definition are used for the control. The internal name of the control remains unchanged regardless of the currently displayed control.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 11

rjay75
Advisor
Advisor

Thank you Phillippe,

 

I'd read that and realized the first control was used. I thought there may have been a way to overide the display name. One more question and then I'll consider this answered. I don't think there may be a way to achieve what I'm trying to do.

 

According to the documentation for AddButtonPopup the Display Mode button on the View tab is an example of a ButtonPopup.

"Method that creates a new popup CommandControl object. An example of this type of control is the 'Display Mode' drop down (Shaded, Hidden Edge, Wireframe) available on the 'View' tab of the ribbon in parts and assemblies."

 

If this is the button the documentation is referring to can the label be set from the API so it always displays the same text. (For instance the Display Mode" always displays "Visual Style". What mode are the buttons in to show the Text and description?

 

ButtonPopup.png

 

This the type of Control on the ribbon I would like use. Can this be done from the API?

 

Thanks,

0 Likes
Message 6 of 11

philippe.leefsma
Alumni
Alumni

Sorry, you just lost me ... did you give a try at creating a Button Popup?

 

As mentionned in the doc:

 

nput ObjectCollection containing the ButtonDefinition objects hosted by this control. The first ButtonDefinition is used as the displayed control. Also, the internal and display names of the first definition are used for the control. The internal name of the control remains unchanged regardless of the currently displayed control.

 

So that seems to be what you are looking for ...



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 7 of 11

rjay75
Advisor
Advisor

Yes I have. At first I thought it operated like a SplitButtonMRU. The difference was it didn't have the split and top button the the SplitButton does, and always showed the list of buttons when pressed. I didn't see the difference originally.

 

The missing behavior the Display Mode button has is the DisplayText on the Display Mode control always shows "Visual Style" regardless of the button selected. The icon changes but the display text doesn't. This was the behavior I thought a ButtonPopup would have but it isn't.

 

Subtle difference that I can live with but I would like to know what kind of Button control the Display Mode is. It would be nice to have the subtle functionality and also all the descriptions showing on the the Popup buttons.

0 Likes
Message 8 of 11

rjay75
Advisor
Advisor
Accepted solution

Upon further examination, the Display Mode control seems to be the only control that exbhits this behavior. The Orthographic and Textures has the same behavior as the ButtonPopup control created through the API.

 

I'll just chalk it up the Display Mode control is something that can't be replicated using the documented API.

 

Thanks for your assistance.

0 Likes
Message 9 of 11

philippe.leefsma
Alumni
Alumni

I'll take a closer look ... let you know.

 

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 10 of 11

rjay75
Advisor
Advisor

Philippe, one thing that is good about the current behavior is the ButtonPopup can be used to convey state as well with the image change and text change. So now I actually prefer the current behavior as I can use it like a combo box with images.

0 Likes
Message 11 of 11

philippe.leefsma
Alumni
Alumni

I see what you mean with the behavior of Display Mode button, I don't see how to achieve the same using existing controls, maybe that control is changing its "CommandControl.DisplayedControl" property at runtime to always have the same text displayed ...

 

Regards,

Philippe.

 

 



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes