CloseSubMenuOnClick Property
Description
Gets or sets whether the popup menu will close as soon as the user makes a mouse click on the menu.
Property Type
Read-write property
Syntax (Visual Basic)
Public Property CloseSubMenuOnClick() As Boolean
Remarks
If True, as soon as you click on a command in the popup menu, the menu will be closed. By default, CloseSubMenuOnClick is True.
If False, the menu will remain open after the command in the popup menu is clicked. This property must be set for each command. This can be useful if some items in the menu are Checked. This will allow you to make multiple selections from the popup menu without having to open the menu for each selection; the menu will stay displayed the entire time.
Note: This will not work with a CustomControl. You can use the ClosePopups method to close a CustomControl popup menu when a user clicks on one of the controls added to the CustomControl.
Example
CloseSubMenuOnClick Sample (Visual Basic)
This sample illustrates how to use the CloseSubMenuOnClick property. If False, the popup menu will not close when the control is clicked.
'Const ID_THEME_OFFICE = 130
'Const ID_THEME_DEFAULT = 131
'Const ID_THEME_OFFICE2003 = 132
'Const ID_THEME_NATIVEXP = 133
Dim ControlThemes As CommandBarPopup
'This will add a popup menu called "Themes" to the ActiveMenuBar, you can select from
'four different themes.
Set ControlThemes = CommandBars.ActiveMenuBar.Controls.Add(xtpControlPopup, 0, "&Themes")
With ControlThemes.CommandBar.Controls
'Adds a control button
Set Control = .Add(xtpControlButton, ID_THEME_OFFICE, "Office XP")
'The popup menu will not close when this button is clicked
Control.CloseSubMenuOnClick = False
'Adds a control button
Set Control = .Add(xtpControlButton, ID_THEME_DEFAULT, "Office 2000")
'The popup menu will not close when this button is clicked
Control.CloseSubMenuOnClick = False
'Adds a control button
Set Control = .Add(xtpControlButton, ID_THEME_OFFICE2003, "Office 2003")
'The popup menu will not close when this button is clicked
Control.CloseSubMenuOnClick = False
'Adds a control button
Set Control = .Add(xtpControlButton, ID_THEME_NATIVEXP, "Windows XP")
'The popup menu will not close when this button is clicked
Control.CloseSubMenuOnClick = False
End With
See Also
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.