split button - separator

split button - separator

GeorgK
Advisor Advisor
1,218 Views
6 Replies
Message 1 of 7

split button - separator

GeorgK
Advisor
Advisor

Hello together,

 

is it possible to add a separator (line) in a split button?

 

Thank you very much

 

Georg

0 Likes
Accepted solutions (1)
1,219 Views
6 Replies
Replies (6)
Message 2 of 7

CCarreiras
Mentor
Mentor

Whaaaat!

CCarreiras

EESignature

0 Likes
Message 3 of 7

GeorgK
Advisor
Advisor

Thats it 🙂

 

Separator.jpg

 

Cheers Georg

0 Likes
Message 4 of 7

Balaji_Ram
Alumni
Alumni

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



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 7

GeorgK
Advisor
Advisor

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
0 Likes
Message 6 of 7

Balaji_Ram
Alumni
Alumni
Accepted solution

Hi Georg,

 

It seems to be working ok at my end. Here is a screenshot and a slightly modified VBA code from the documentation :

 

SplitBtn_Separator.png

 

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



Balaji
Developer Technical Services
Autodesk Developer Network

Message 7 of 7

GeorgK
Advisor
Advisor

Hello Balaji,

 

thank you very much. Got it running now 🙂

 

Georg

0 Likes