AddCommandToMenu method

Applies to
UserInterface object

Return Type

This method adds the specified command (user-defined menu) at the bottom of a specified menu.

Use this method to add a command to a menu on a ReadSoft Invoices module's user interface.

The command is added to the menu with the specified menu number in the user's current menu frame. If a user action causes a new menu frame to be displayed, the command disappears.

For example, assume you want to add a command to Interpret's File menu. The command should be available both before and after the user opens a job. You must add the command to the menu twice-once for each menu frame. When Interpret starts, use AddCommandToMenu to add the command to the File menu. Then, when the JobLoaded event occurs, its event handler calls AddCommandToMenu again to add the command to the other menu frame.

Note
  • User-defined menus are not available in Scan.
  • If you have trouble displaying a user-defined menu, delete the eiveri.ini file located in the Windows folder.

None.

object.AddCommandToMenu( sCommandName As String, nMenuNo As Long, sMenuItemCaption As String)

Part

Description

object

An expression evaluating to an object of type

UserInterface

CommandName

The name of the command to execute. The command can be a built-in command or one added using AddCommand. For the names of the built-in commands, see DeleteCommand.

If you add a command in a context where it does not belong, the command will not do anything. For example, if you add the Approve command to the File menu of the first menu frame that appears when Verify is started, the command will not have any effect.

MenuNo

The menu number (where 1 is the left-most menu) of the menu as it is displayed on the ReadSoft Invoices module user interface. For example, the File menu is always menu number 1. The value is constant during the scope of the function that made the call to AddCommandToMenu.

If the user performs an action that changes which menus are displayed, or which selections are displayed on the menus, the ReadSoft Invoices module displays a different menu frame. The menu number can change from one menu frame to another.

You can get the menu number of the user-defined menu using GetUserDefinedMenuPos.

You need to know the appearance of the menu frame you are working with, to find the menu number of the built-in menus.

MenuItemCaption

The text to appear on the menu.

Output

Description

CommandNotFound

The command specified is neither a built-in command nor an added command.

MenuDoesNotExist

There is no menu with the specified menu number.

Related topics

DeleteCommand

InitUserDefinedMenu