Using commands

Commands are primarily used for navigation in an application. They are the basis of command-based menus and toolbars.

Command form

Commands are a form-based resource. For a command to be accessed, the form it is part of must be open at the time the command is used. For stand-alone applications, commands that should always be available could be defined for the Main Menu form.

You might also want to create separate command forms that contain groups of related commands. This gives added flexiblity when controlling access to commands. Opening or closing the command form will control whether the commands are available. This is the approach used by applications that integrate with Microsoft Dynamics GP. Each integrating application defines its own command form.

If a command is part of an active form, it available to be used, even if it does not appear on a menu or a toolbar.


Tags

When a command is made available, it is automatically assigned a tag. A tag is an integer that uniquely identifies that command for the current application session. A tag for a command is retrieved using the Command_GetTag() function. The tag is required when running other commands such as Command_GetType().

Don’t store the tag for a command. A new tag is assigned to the command each time the application is run.


Command lists

A command list is a special type of command used to group related commands for use in toolbars or command-based menus. Commands are added to a command list using functions from the Command list function library. You will also use functions from this library to manage the contents of command lists.

Menus

Commands and command lists form the basis of command-based menus. Refer to Command-based Menus for more information.

Toolbars

Commands and command lists are also used for toolbars that can be displayed in an application. Refer to Toolbars for more information.

Running commands

Form and script commands can be executed directly by the user when the commands appear on menus or toolbars. They can also be run through scripts. You can run a command directly using the run command statement. If only the tag for the command is available, use the Command_Execute() function.


Documentation Feedback