IToolbarMenu Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > IToolbarMenu Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Controls)  

IToolbarMenu Interface

Provides access to members that control ToolbarControl menu items. Note: the IToolbarMenu interface has been superseded byIToolbarMenu2. Please consider using the more recent version.

Product Availability

Available with ArcGIS Engine.


A ToolbarMenu supplies the implementation of a menu item that can host Command, Tool, ToolControl, MultiItem and ToolbarPalette objetcs. A ToolbarMenu can either be hosted on the ToolbarControl or can appear as a popup menu.

A ToolbarMenu can be built in two ways. Firstly, an object implementing IMenuDef can be passed to the IToolbarControl::AddItem or IToolbarControl::AddMenuItem method which creates a ToolbarMenu object and populates it from the menu definition. Secondly, the properties and methods on the IToolbarMenu interface can be used to build a menu. Any sub menus on a ToolbarMenu are implemented as another instance of a IToolbarMenu.


Name Description
Method AddItem Adds an item to the ToolbarMenu.
Method AddSubMenu Adds a sub-menu to the ToolbarMenu.
Read/write property Bitmap The bitmap that is used as the icon on this ToolbarMenu.
Read/write property Caption The caption used by the ToolbarMenu.
Read/write property CommandPool The CommandPool used by the ToolbarMenu.
Read-only property Count The number of items on the ToolbarMenu.
Method Find Returns the index of the first item containing the given command or menu. Returns -1 if it is not found.
Method GetItem Returns the item at the specified index from the ToolbarMenu.
Method GetMenuDef Returns the menu definition, this method is obsolete.
Read-only property Hook The object that is passed as a hook to the OnCreate event of each item's command.
Method MoveItem Moves an item from one index to another.
Method PopupMenu Pops up the menu at the position specified.
Method Remove Removes the item at the specified index from the ToolbarMenu.
Method RemoveAll Removes all items from the ToolbarMenu.
Method SetHook Sets the object that is passed as a hook to the OnCreate event of each item's command.

CoClasses that implement IToolbarMenu

CoClasses and Classes Description
ToolbarMenu A menu containing commands that can be used from a ToolbarControl or as a popup menu.


ToolbarMenu items support accelerator (shortcut) and access keys, defined in the ICommand::Caption property. For example, a 'Close' command with the caption "&Close\tAlt+F4" has the 'ALT+F4' key combination as its shortcut key, and the 'C' key as its access key. Although a shortcut key will always work, an access key will only work when the ToolbarMenu is active.

.NET Snippets

Add Editing Commands to ToolbarControl | Create PopUp ToolbarMenu

.NET Samples

Creating toolbar menus that work with the ToolbarControl (Code Files: ToolbarMenu) | Cut polygons without selection edit task (Code Files: EditingForm) | Custom reshape polyline edit task (Code Files: EditingForm) | ArcGIS Network Analyst extension Engine application (Code Files: frmMain) | Displaying a TOCControl context menu (Code Files: TOCContextMenuForm) | Managing snap agents (Code Files: EditingForm) | Using HookActions in custom commands (Code Files: HookActions) | Custom vertex editing commands (Code Files: EditingForm) | Building a MapViewer application using the ArcGIS Engine controls (Code Files: MapViewer) | Edit event listener (Code Files: EditingForm) | Schematics Engine application (Code Files: MainForm) | Feature editing with the control commands (Code Files: FeatureEditing)

.NET Related Topics

Building a map viewing application using the ArcGIS Engine controls | Enabling menu tracking on the ToolbarControl