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
-
Create a top-level form menu. For more information about creating menus for top-level forms, see Designing Menus and Toolbars.
-
Set the form's ShowWindow Property to 2 – As Top-Level Form.
-
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:В Copy Code DO mySDImenu.mpr WITH THIS, .T.