This document is archived and information here might be outdated.  Recommended version.


IToolbarMenu Interface (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > IToolbarMenu Interface
ArcGIS Developer Help

IToolbarMenu Interface

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

Product Availability

Available with ArcGIS Engine.

Description

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.

Members

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.

Classes that implement IToolbarMenu

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

Remarks

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 Samples

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