Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AddButtonPopup versus AddSplitButtonMRU

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
rjay75
837 Views, 10 Replies

AddButtonPopup versus AddSplitButtonMRU

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?

 

 

10 REPLIES 10
Message 2 of 11
philippe.leefsma
in reply to: rjay75

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

Message 3 of 11
rjay75
in reply to: philippe.leefsma

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.

Message 4 of 11
philippe.leefsma
in reply to: rjay75

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

Message 5 of 11
rjay75
in reply to: philippe.leefsma

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,

Message 6 of 11
philippe.leefsma
in reply to: rjay75

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

Message 7 of 11
rjay75
in reply to: philippe.leefsma

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.

Message 8 of 11
rjay75
in reply to: rjay75

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.

Message 9 of 11
philippe.leefsma
in reply to: rjay75

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

 

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 10 of 11
rjay75
in reply to: philippe.leefsma

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.

Message 11 of 11
philippe.leefsma
in reply to: rjay75

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report