Skip to main content

When it is launched

The event occurs when calling a user command (provided that a corresponding item is added to the main menu or on the toolbar). User command identifiers can be represented in the form of CI_UserCommand + <non-negative integer>.

Parameters

NameTypeAccessDescription
CommandIdTCommandIDRead/writeThe identifier of the user command
ContextIMainWindowRead/writeThe main window of the application
To add a user command to the main menu or on the toolbar, you must use AppendItem / InsertItem and AppendButton /InsertButton methods of the IMenu interface and the IToolbar interface respectively. The command identifiers CI_UserCommand or CI_UserCommand + <non-negative integer> must be used.
The sample code below demonstrates how to add a menu item for a user command with a command identifier CI_UserCommand + 1.
ABBYY.FlexiCapture.ClientUI.TCommandID userCommand = ABBYY.FlexiCapture.ClientUI.TCommandID.CI_UserCommand;
ABBYY.FlexiCapture.ClientUI.TCommandID userCommand1 = (ABBYY.FlexiCapture.ClientUI.TCommandID) ((int)userCommand + 1);
IMenu menu = MainWindow.MainMenu[0].Submenu;
menu.AppendItem( userCommand1, "User command" );
A toolbar button or a menu item added for a user command will be disabled unless a handler of the On User Command event is added. The sample code below demonstrates processing the On User Command event.
ABBYY.FlexiCapture.ClientUI.TCommandID commandID = ( ABBYY.FlexiCapture.ClientUI.TCommandID )( CommandId );
ABBYY.FlexiCapture.ClientUI.TCommandID userCommand = ABBYY.FlexiCapture.ClientUI.TCommandID.CI_UserCommand;
ABBYY.FlexiCapture.ClientUI.TCommandID userCommand1 = (ABBYY.FlexiCapture.ClientUI.TCommandID) ((int)userCommand + 1);
if( commandID == userCommand1 ) {
<... call necessary methods here ...>