SetTearOffPopup Method
Description
Allows a command bar associated with a popup menu to be made into a floating command bar by tearing it away from the popup menu.
Syntax
Public Sub SetTearOffPopup( _
ByVal [Caption](#) As String, _
ByVal [Id](#) As Long, _
ByVal [Width](#) As Long _
)
Parameters
- Caption: The caption of the command bar when it is torn off.
- Id: The id of the command bar when it is torn off.
- Width: The width of the command bar when it is torn off.
Remarks
When the popup menu is displayed, you will be able to "tear" the popup away and create a new toolbar.
Example
This sample code illustrates how to add your controls to a tear-off popup menu.
Dim Standard As CommandBar
Dim BoardersPopup As CommandBarPopup
Set Standard = CommandBars.Add("Standard", xtpBarTop)
With Standard.Controls
Set BoardersPopup = .Add(xtpControlSplitButtonPopup, ID_BDR_BUTTON, "Boarders")
BoardersPopup.IconId = ID_BDR_NONE
BoardersPopup.CommandBar.Controls.Add xtpControlButton, ID_BDR_OUTSIDE, "Outside"
BoardersPopup.CommandBar.Controls.Add xtpControlButton, ID_BDR_ALL, "All"
BoardersPopup.CommandBar.Controls.Add xtpControlButton, ID_BDR_TOP, "Top"
BoardersPopup.CommandBar.Controls.Add xtpControlButton, ID_BDR_LEFT, "Left"
BoardersPopup.CommandBar.Controls.Add xtpControlButton, ID_BDR_INSIDE_HORZ, "Inside Horizontal"
BoardersPopup.CommandBar.Controls.Add xtpControlButton, ID_BDR_INSIDE, "Inside"
BoardersPopup.CommandBar.Controls.Add xtpControlButton, ID_BDR_NONE, "None"
BoardersPopup.CommandBar.Controls.Add xtpControlButton, ID_BDR_BOTTOM, "Bottom"
BoardersPopup.CommandBar.Controls.Add xtpControlButton, ID_BDR_RIGHT, "Right"
BoardersPopup.CommandBar.Controls.Add xtpControlButton, ID_BDR_INSIDE_VERT, "Inside Vertical"
' This line of code specifies that the popup menu can be "torn" off and float in a separate window.
BoardersPopup.CommandBar.SetTearOffPopup "Boarders", IDR_BOARDERSBAR, 150
' This line of code specifies that the popup menu will be displayed as a toolbar popup
BoardersPopup.CommandBar.SetPopupToolBar True
BoardersPopup.CommandBar.Width = 120
End With
See Also
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.