Partager via


How to: Add a Menu to a Top-Level Form

Menus on top-level forms not only provide form navigation, they can provide initial clues about the design of your application.

To add a menu to a top-level form

  1. Create a top-level form menu. For more information about creating menus for top-level forms, see Designing Menus and Toolbars.

  2. Set the form's ShowWindow Property to 2 – As Top-Level Form.

  3. In the Init Event of the form, run the menu program and pass it two parameters:

    DO menuname.mpr WITH oForm, lAutoRename

    oForm is an object reference to the form. In the Init event of the form, pass THIS as the first parameter.

    lAutoRename specifies whether or not a new unique name is generated for the menu. If you plan to run multiple instances of the form, pass .T. for lAutoRename.

    For example, you can call a menu called mySDImenu with this code:

    DO mySDImenu.mpr WITH THIS, .T.
    

See Also

Tasks

How to: Hide the Main Visual FoxPro Window

How to: Extend Forms with Form Sets

How to: Add Visual FoxPro Containers

Concepts

Creation of Single- and Multiple-Document Interfaces

Adding Objects to Forms

Other Resources

Creating Forms