How to: Perform Tasks with Commands
|Visual FoxPro 9.0 SP2|
|How to: Perform Tasks with Commands|
When a menu or menu item is selected, it performs a task, such as displaying a form, a toolbar, or another menu system. To perform a task, a menu or menu item must execute a Visual FoxPro command. The command can be contained in one line, or it can be a procedure call.
If you expect to use a set of commands in several places, write a procedure. The procedure should be explicitly named and written in the menu cleanup code, or somewhere where it can be referenced by any menu or object. For more information, see.
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. For more information, see .
To assign a command to a menu or menu item
In the Prompt column, select the appropriate menu title or menu item.
In the Result box, select Command.
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.
To display a form or dialog box
Use the DO FORM command with the form's name.
For example, to display a form named "Orders," use the following command:
DO FORM Orders
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.
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.
Comment or report problem with topic