ArcObjects Library Reference (Framework)  

ICommandItem Interface

Provides access to members that define a command item.

Product Availability

Available with ArcGIS Desktop.

When To Use

A CommandItem is any item on a commandbar. For example, buttons, tools, and menu items that appear on commandbars are all commanditems. The ICommandItem interface allows you to get or set the properties of the commanditem such as caption, button image, statusbar message, tooltip, display style, help context ID, and more. The ICommandItem interface also provides methods to execute, delete, refresh, and reset the commanditem. Use ICommandBars::Find, ICommandBar::Find, or ICommandBar::Item to obtain a reference to a particular commanditem.

Members

Description
Read/write property Action The name of the VBA macro this command should run when pressed.
Read-only property BuiltIn Indicates whether this command item is built-in or if it was implemented through VBA.
Read/write property Caption The caption of this command item.
Read-only property Category The name of the category with which this command item is associated.
Read-only property Command A reference to the internal command object.
Method Delete Removes this object from the commandbar.
Method Execute Causes the command to execute.
Read/write property FaceID The bitmap that is used as the icon on this command item.
Read/write property Group Indicates if this command item begins a menu or toolbar group.
Read/write property HelpContextID The help context ID associated with this command item.
Read/write property HelpFile The help file associated with this command item.
Read-only property ID The unique integer ID associated with this command item.
Read-only property Index The positional index of this command item within its menu or toolbar.
Read/write property Message The status bar message for this command item.
Read/write property Name The name of this command item.
Read-only property Parent The menu or toolbar that this command item currently resides on.
Method Refresh Causes the command to be redrawn.
Method Reset Restores this command item's properties to that of the original.
Read/write property Style The display style of this command item.
Read/write property Tag The tag for this command item.
Read/write property Tooltip The tooltip for this command item.
Read-only property Type The type of this command item.

CoClasses that implement ICommandItem

CoClasses and Classes Description
CommandBar CommandBar object.
CommandItem Command Item.

See Also

ICommandBar.Item Property | ICommandBar.Find Method | ICommandBar.Popup Method | ICommandBar.CreateMacroItem Method | ICommandBars.Find Method | ICommandBar.Add Method

.NET Snippets

Get Command on Toolbar by Names | Find Command and Execute | Statements - Use a Tool in a Windows Form | Get Toolbar by Name | Use Custom Tool on Windows Form | Set Tool Active in ToolBar | Get Command by Name | List ArcMap Visible Toolbars |

.NET Samples

Applying user interface customizations at startup (Code Files: AcmeExt) | Custom subtyped command and tool (Code Files: ZoomInCommands) | Simple logging dockable window with a custom context menu (Code Files: LoggingDockableWindow) |

.NET Related Topics

How to create multiple commands or tools in a single class subtyped command |