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:

     CopyCode imageCopy Code
    DO mySDImenu.mpr WITH THIS, .T.

See Also

© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic