Partager via


How to: Test and Debug a Menu System

You can preview a menu system as you design it or you can test and debug it after generating the menu program.

To preview a menu system as you design it

When you choose Preview, the menu system you've defined appears at the top of the screen. Additionally, the Preview dialog box displays the file name (or a temporary file name) of the menu system.

If you select a menu title or menu item, it also appears in the Preview dialog box, along with the command assigned to it, if there is one.

To test a menu system

  1. From the Menu menu, choose Generate.

    If you've changed the menu, Visual FoxPro prompts you to save the changes.

  2. In the Generate Menu dialog box, enter a name for the generated menu program by typing the name in the Output File box or by choosing the dialog button.

  3. Choose Generate to produce a menu program file with an .mpr extension.

  4. From the Program menu, choose Do to run the program.

    Warning

    If you modify the generated menu program (the .mpr file), you'll lose the changes when you modify the menu using the Menu and Shortcut Designers and then regenerate the menu program.

If the menu program doesn't work as intended, use the diagnostic tools provided with Visual FoxPro. For more information, see Testing and Debugging Applications.

Tip

If you run an application (.exe file) in which the main program is a menu and the application terminates as soon as the menu is displayed, include the READ EVENTS Command in the cleanup code. You must also assign a CLEAR EVENTS command to the menu command that allows the user to exit the menu system.

See Also

Tasks

How to: Add a Coordinated Toolbar and Menu to a Form Set

How to: Customize a Menu System

Reference

Customize Toolbar Dialog Box (Visual FoxPro)

Other Resources

Creating Custom Toolbars

Designing Menus and Toolbars

Customizing the Visual FoxPro Environment