Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to move the button that created to the expanded panel. For example, how do I move the "Draw Slot" button to the expanded panel? Thanks in advance.
if (firstTime == true)
{
//access user interface manager
UserInterfaceManager userInterfaceManager;
userInterfaceManager = m_inventorApplication.UserInterfaceManager;
InterfaceStyleEnum interfaceStyle;
interfaceStyle = userInterfaceManager.InterfaceStyle;
//create the UI for classic interface
if (interfaceStyle == InterfaceStyleEnum.kClassicInterface)
{
//create toolbar
CommandBar slotCommandBar;
slotCommandBar = userInterfaceManager.CommandBars.Add("Slot", "Autodesk:SimpleAddIn:SlotToolbar", CommandBarTypeEnum.kRegularCommandBar, addInCLSIDString);
//add comboboxes to toolbar
slotCommandBar.Controls.AddComboBox(m_slotWidthComboBoxDefinition, 0);
slotCommandBar.Controls.AddComboBox(m_slotHeightComboBoxDefinition, 0);
//add buttons to toolbar
slotCommandBar.Controls.AddButton(m_addSlotOptionButton.ButtonDefinition, 0);
slotCommandBar.Controls.AddButton(m_drawSlotButton.ButtonDefinition, 0);
slotCommandBar.Controls.AddButton(m_toggleSlotStateButton.ButtonDefinition, 0);
//Get the 2d sketch environment base object
Inventor.Environment partSketchEnvironment;
partSketchEnvironment = userInterfaceManager.Environments["PMxPartSketchEnvironment"];
//make this command bar accessible in the panel menu for the 2d sketch environment.
partSketchEnvironment.PanelBar.CommandBarList.Add(slotCommandBar);
}
//create the UI for ribbon interface
else
{
//get the ribbon associated with part document
Inventor.Ribbons ribbons;
ribbons = userInterfaceManager.Ribbons;
Inventor.Ribbon partRibbon;
partRibbon = ribbons["Part"];
//get the tabls associated with part ribbon
RibbonTabs ribbonTabs;
ribbonTabs = partRibbon.RibbonTabs;
RibbonTab partSketchRibbonTab;
partSketchRibbonTab = ribbonTabs["id_TabSketch"];
//create a new panel with the tab
RibbonPanels ribbonPanels;
ribbonPanels = partSketchRibbonTab.RibbonPanels;
m_partSketchSlotRibbonPanel = ribbonPanels.Add("Slot", "Autodesk:SimpleAddIn:SlotRibbonPanel", "{DB59D9A7-EE4C-434A-BB5A-F93E8866E872}", "", false);
//add controls to the slot panel
CommandControls partSketchSlotRibbonPanelCtrls;
partSketchSlotRibbonPanelCtrls = m_partSketchSlotRibbonPanel.CommandControls;
//add the combo boxes to the ribbon panel
CommandControl slotWidthCmdCboBoxCmdCtrl;
slotWidthCmdCboBoxCmdCtrl = partSketchSlotRibbonPanelCtrls.AddComboBox(m_slotWidthComboBoxDefinition, "", false);
CommandControl slotHeightCmdCboBoxCmdCtrl;
slotHeightCmdCboBoxCmdCtrl = partSketchSlotRibbonPanelCtrls.AddComboBox(m_slotHeightComboBoxDefinition, "", false);
//add the buttons to the ribbon panel
CommandControl drawSlotCmdBtnCmdCtrl;
drawSlotCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_drawSlotButton.ButtonDefinition, false, true, "", false);
CommandControl slotOptionCmdBtnCmdCtrl;
slotOptionCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_addSlotOptionButton.ButtonDefinition, false, true, "", false);
CommandControl toggleSlotStateCmdBtnCmdCtrl;
toggleSlotStateCmdBtnCmdCtrl = partSketchSlotRibbonPanelCtrls.AddButton(m_toggleSlotStateButton.ButtonDefinition, false,true, "", false);
}
}
Solved! Go to Solution.