Freigeben über


Adding a Menu to a Top-Level Form

Menus on top-level forms not only provide forma 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

Creation of Single- and Multiple-Document Interfaces | Hiding the Main Visual FoxPro Window | Extending Forms with Form Sets | Creating Forms | Addition of Objects to Forms | Adding Visual FoxPro Containers