Commands Object (ICommands Interface)

This object provides access to the commands of a Visual Component. These commands can appear in the context menu of a component and in its toolbar (if exists). You can enable or disable commands and add custom commands for Visual Components. See Customizing the Context Menu and Toolbar of a Visual Component or details.

The following Visual Components allow you to manage their commands: ImageViewer, ZoomViewer, DocumentViewer, TextEditor. See the list of available commands and the ways these commands can be used in each component:

The information about executing commands is reported through a special outgoing interfaces. These interfaces are ICommandEvents (for C++) and a dispinterface DICommandEvents (for Visual Basic).

It's worth noting that Visual Basic users should not care for details of event interfaces implementation as this development platform provides easy means for handling them. This object may be declared WithEvents in Visual Basic.

For C++ user this fact means that it supports the IConnectionPointContainer interface. To receive notification events, a C++ user should create an object derived from the ICommandEvents interface, then set up the connection between it and events source implemented in Commands object by standard COM means.

Properties

Name Type Description
Count int, read-only Retrieves a number of commands available in the Visual Component.
Element MenuItemEnum, read-only Returns the identifier of the command with the specified index.

Methods

Name Description
DisableCommand Disables the specified command.
DoCommand Executes the specified command in synchronous or asynchronous mode.
EnableCommand Enables the specified command.
HasHotKey Specifies whether the hot key is used by some command.
IsUserCommandRegistered Specifies whether the specified user-defined command is registered.
RegisterUserCommand Registers a user-defined command.
UnregisterUserCommand Cancels the registration of the specified user-defined command.

Samples

This object is used in the following code samples: VisualComponents.

See also

IImageViewer::Commands

IZoomViewer::Commands

IDocumentViewer::Commands

ITextEditor::Commands

ICommandEvents

Customizing the Context Menu and Toolbar of a Visual Component

9/17/2024 3:14:40 PM

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.