Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello together,
is it possible to add a separator (line) in a split button?
Thank you very much
Georg
Solved! Go to Solution.
Hello together,
is it possible to add a separator (line) in a split button?
Thank you very much
Georg
Solved! Go to Solution.
Whaaaat!
Hi Georg,
The "CommandControl.ChildControls.AddSeparator" should help with this.
Here is a sample code snippet to add to the end of the list, but you can reposition the separator by passing parameters to AddSeparator method.
Dim oSplitBtn As CommandControl
Set oSplitBtn = oPanel.CommandControls.AddSplitButton(oDef1, oDefs, True)
oSplitBtn.ChildControls.AddSeparator
Cheers,
Balaji
Hello Balaji,
thanks for the sample. I could add the vertical lines but not the horizontal line in the split button.
Georg
oPanel2.CommandControls.AddSeparator()'Vert. line ' Create a split button control Dim oDefs As ObjectCollection oDefs = m_inventorApplication.TransientObjects.CreateObjectCollection oDefs.Add(oButtonDefinition1) oDefs.Add(oButtonDefinition2) 'hor. line ?? oDefs.Add(oButtonDefinition3) Call oPanel2.CommandControls.AddSplitButton(oButtonDefinition2, oDefs, True) Call oPanel2.CommandControls.AddSeparator() 'Vert. line
Hi Georg,
It seems to be working ok at my end. Here is a screenshot and a slightly modified VBA code from the documentation :
Sub AddPanelToToolsTab() ' Get the ribbon associated with the part document Dim oPartRibbon As Ribbon Set oPartRibbon = ThisApplication.UserInterfaceManager.Ribbons.Item("Part") ' Get the "Tools" tab Dim oTab As RibbonTab Set oTab = oPartRibbon.RibbonTabs.Item("id_TabTools") ' Create a panel named "Update", positioned after the "Measure" panel in the Tools tab. Dim oPanel As RibbonPanel Set oPanel = oTab.RibbonPanels.Add("Update", "ToolsTabUpdatePanel", "SampleClientId", "id_PanelP_ToolsMeasure") ' Get the update commands Dim oDef1 As ButtonDefinition Set oDef1 = ThisApplication.CommandManager.ControlDefinitions.Item("AppLocalUpdateCmd") Dim oDef2 As ButtonDefinition Set oDef2 = ThisApplication.CommandManager.ControlDefinitions.Item("AppUpdateMassPropertiesCmd") Dim oDefs As ObjectCollection Set oDefs = ThisApplication.TransientObjects.CreateObjectCollection oDefs.Add oDef1 oDefs.Add oDef2 ' Create a split button control Dim oSplitBtn As CommandControl Set oSplitBtn = oPanel.CommandControls.AddSplitButton(oDef1, oDefs, True) Call oSplitBtn.ChildControls.AddSeparator("AppUpdateMassPropertiesCmd", True) ' Get the rebuild command Dim oDef3 As ButtonDefinition Set oDef3 = ThisApplication.CommandManager.ControlDefinitions.Item("AppRebuildAllWrapperCmd") ' Create a button control Call oPanel.CommandControls.AddButton(oDef3, True) End Sub
Regards,
Balaji