Message 1 of 3
Change button order on ribbon from addin C#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have read several forum post on this and other forums and websites, however it is still not clear to me: how can you change the button order/the place a button is placed using the API?
I know it has to do with InsertBeforeTargetControl in the AddButton method from the API, but how is that working? I assume a button has an internal name (TargetControlInternalName). Or is that the name of the button it should replace when you set InsertBeforeTargetControl to true or false?
Currently I have this code for my butons, showing up on our company tab (and two buttons on a drawing tab):
if (!(PropertyEditorButton == null))
{
Panel_Properties_prt.CommandControls.AddButton(PropertyEditorButton, true, true, "PropertyEditorButtonPanelPropertiesPrt");
Panel_Properties_asm.CommandControls.AddButton(PropertyEditorButton, true, true, "PropertyEditorButtonPanelPropertiesAsm");
Panel_Properties_dwg.CommandControls.AddButton(PropertyEditorButton, true, true, "PropertyEditorButtonPanelPropertiesDwg");
//Panel_Properties_prn.CommandControls.AddButton(PropertyEditorButton, true, true, "PropertyEditorButtonPanelPropertiesprn");
}
if (!(ContentListButton == null))
{
Panel_Layouting_Asm.CommandControls.AddButton(ContentListButton, true, true, "ContentListButtonPanelLayoutingAsm");
}
if (!(SystemLayoutChecklistButton == null)) { Panel_Layouting_Asm.CommandControls.AddButton(SystemLayoutChecklistButton, true, true, "LayoutCheckListButtonPanelLayoutingAsm"); }
if (!(SheetSizeDownButton == null))
{
Panel_Drawing_Dwg.CommandControls.AddButton(SheetSizeDownButton, true, true, "SheetSizeDownButtonPanelDrawingDwg");
dwgRibbon.RibbonTabs["id_TabPlaceViews"].RibbonPanels["id_PanelD_PlaceViewsSheets"].CommandControls.AddButton(SheetSizeDownButton, true, true, "SheetSizeDownButtonPanelPlaceViewSheets");
}
if (!(SheetSizeUpButton == null))
{
Panel_Drawing_Dwg.CommandControls.AddButton(SheetSizeUpButton, true, true, "SheetSizeUpButtonPanelDrawingDwg);
dwgRibbon.RibbonTabs["id_TabPlaceViews"].RibbonPanels["id_PanelD_PlaceViewsSheets"].CommandControls.AddButton(SheetSizeUpButton, true, true, "SheetSizeUpButtonPanelPlaceViewSheets");
}
Panel_Drawing_Dwg.CommandControls.AddSeparator();
if (!(DrawingUpdateButton == null)) { Panel_Drawing_Dwg.CommandControls.AddButton(DrawingUpdateButton, true, true, "DrawingUpdateButtonPanelDrawingDwg"); }
if (!(SettingsButton == null))
{
Panel_Settings_Zero.CommandControls.AddButton(SettingsButton, true, true, "SettingsButtonPanelSettingsZero");
Panel_Settings_Prt.CommandControls.AddButton(SettingsButton, true, true, "SettingsButtonPanelSettingsPrt");
Panel_Settings_Asm.CommandControls.AddButton(SettingsButton, true, true, "SettingsButtonPanelSettingsAsm");
Panel_Settings_Dwg.CommandControls.AddButton(SettingsButton, true, true, "SettingsButtonPanelSettingsDwg");
Panel_Settings_Prn.CommandControls.AddButton(SettingsButton, true, true, "SettingsButtonPanelSettingsPrn");
}
I want the SettingsButton to be placed at the end of all other buttons. How should I do this?