Performing Tasks with Procedures

You can assign a procedure to a menu or menu item. The way you assign a procedure depends on whether the menu or menu item has submenus.

To assign a procedure to a menu or menu item without submenus

  1. In the Prompt column, select the appropriate menu title or menu item.

  2. In the Result box, select Procedure.

    A Create button appears to the right of the list. If a procedure has been defined previously, an Edit button appears instead.

  3. Select Create or Edit.

  4. Type the appropriate code in the window.

    Note   You don't need to type the PROCEDURE command in the procedure editing window because Visual FoxPro generates this statement for you. The only place you need the PROCEDURE statement is in the cleanup code.

To assign a procedure to a menu or menu item with submenus

  1. In the Menu level box, select the level that includes the appropriate menu or menu item. For example, suppose your menu system includes the Customer menu created earlier. To assign a procedure to the Customer menu, select the "Menu Bar" level in the Menu Level box. Similarly, to assign a procedure to an item on the Customer menu, select the "Customer" level in the list.

  2. From the View menu, choose Menu Options.

    Visual FoxPro displays the Menu Options dialog box.

  3. Assign the procedure by doing one of the following:

    • Write or call a procedure in the Procedure box.

      -or-

    • Choose Edit and then OK to open a separate editing window and write or call a procedure.

See Also

Performing Tasks with Commands | Adding Setup Code to a Menu System | Adding Cleanup Code to a Menu System | Designing Menus and Toolbars | Compiling an Application