Share via


Performing Tasks with Commands

To perform a task, you can assign a command to a menu or menu item. A command can be any valid Visual FoxPro command, including a call to a program that exists on your path or a procedure defined in the Cleanup option of the General Options dialog box. For more information, see Creating a Default Procedure for a Menu System.

To assign a command to a menu or menu item

  1. In the Prompt column, select the appropriate menu title or menu item.
  2. In the Result box, select Command.
  3. In the box to the right of the Result box, type the appropriate command:

If the command calls a procedure in the menu's cleanup code, use the DO command with the following syntax:

DO procname IN menuname

In this syntax, menuname specifies the location of the procedure. This is the name of the menu file and must have the .mpr extension. If you don't specify the location in menuname, you must specify it with SET PROCEDURE TO menuname.mpr, if the procedure is in the menu cleanup code.

Displaying Forms and Dialog Boxes

From a menu or menu item, you can display a compiled form or dialog box by calling it with a command or procedure. For example, to display a form named "Orders," use the following command:

DO FORM Orders

Tip   When you create a menu or menu item that displays a form or dialog box, put three dots at the end of the prompt to indicate that more user input is required.

Displaying Toolbars

If you create a custom toolbar for an application, you can display it by calling it from a menu or menu item. For details, see Creating Custom Toolbars.

See Also

Enabling and Disabling Menu Items | Performing Tasks with Procedures | Adding Setup Code to a Menu System | Designing Menus and Toolbars | Compiling an Application