Create Flyout Toolbars
From AutoCAD ActiveX
To add a flyout toolbar button to a toolbar, use the AddToolbarButton method. This method creates a new ToolbarItem object and adds it to the designated toolbar.
The AddToolbarButton method takes five parameters as input: Index, Name, HelpString, Macro, and FlyoutButton. By setting the FlyoutButton parameter to TRUE, the new button will be created as a flyout button. The return value from this method will be the new flyout toolbar. The flyout toolbar can then be populated as a normal toolbar would be.
For more information about populating a toolbar, see Add New Toolbar Buttons to a Toolbar.
Create a flyout toolbar button
This example creates two toolbars. The first toolbar contains a flyout button. The second toolbar is attached to the flyout button on the first toolbar.
Sub Ch6_AddFlyoutButton()
Dim currMenuGroup As AcadMenuGroup
Set currMenuGroup = ThisDrawing.Application. _
MenuGroups.Item(0)
' Create the first toolbarDim FirstToolbar As AcadToolbarSet FirstToolbar = currMenuGroup.Toolbars. _Add("FirstToolbar")' Add a flyout button to the first menu on the menu barDim FlyoutButton As AcadToolbarItemSet FlyoutButton = FirstToolbar.AddToolbarButton _("", "Flyout", "Demonstrates a flyout button", _"OPEN", True)' Create the second toolbar. This will be attached to' the first toolbar through the flyout button.Dim SecondToolbar As AcadToolbarSet SecondToolbar = currMenuGroup.Toolbars. _Add("SecondToolbar")' Add a button to the next toolbarDim newButton As AcadToolbarItemDim openMacro As String' Assign the macro the VB equivalent of "ESC ESC _open "openMacro = Chr(3) + Chr(3) + "_open "Set newButton = SecondToolbar.AddToolbarButton _("", "NewButton", "Open a file.", openMacro)' Attach the second toolbar to the flyout' button on the first toolbarFlyoutButton.AttachToolbarToFlyout currMenuGroup.Name, _SecondToolbar.Name' Display the first toolbar, hide the second toolbarFirstToolbar.Visible = TrueSecondToolbar.Visible = FalseEnd Sub