* To attach any menu to your Top-Level form, * call it from the Init event of the form: * Syntax: DO <mprname> WITH <oFormRef> [,<cMenuname>|<lRename>] * oFormRef - form object reference (THIS) * cMenuname - name for menu * lRename - renames Name property of your form * example: * PROCEDURE Init * DO mymenu.mpr WITH THIS,.T. * ENDPROC * Use the optional 2nd parameter if you plan on running * multiple instances of your Top-Level form. The logical * lRename parameter will change the name property of your * form to the same name given the menu and may cause conflicts * in your code if you directly reference the form by name. * You will also need to remove the menu when the form is * destroyed so that it does not remain around in memory * unless you wish to reactivate it later in a new form. * If you passed the optional lRename parameter as .T. as in * the above example, you can easily remove the menu in the * form's Destroy event as shown below. This strategy is ideal * when using multiple instances of Top-Level forms. * example: * PROCEDURE Destroy * RELEASE MENU (THIS.Name) * ENDPROC *!* LPARAMETER oFormRef,getMenuName *!* LOCAL cMenuName *!* IF TYPE("m.oFormRef") # "O" OR ; *!* LOWER(m.oFormRef.BaseClass) # 'form' OR ; *!* m.oFormRef.ShowWindow # 2 *!* MESSAGEBOX([This menu can only be called from a Top-Level form. Ensure that your form's ShowWindow property is set to 2. Read the header section of the menu's MPR file for more details.]) *!* RETURN *!* ENDIF *!* m.cMenuName = IIF(TYPE("m.getMenuName")="C",m.getMenuName,SYS(2015)) *!* IF TYPE("m.getMenuName")="L" AND m.getMenuName *!* m.oFormRef.Name = m.cMenuName *!* ENDIF *!* DEFINE MENU (m.cMenuName) IN (m.oFormRef.Name) BAR *!* ALL CODE FOR THE MENUS AND POPUPS *!* ACTIVATE MENU (m.cMenuName) NOWAIT *!* ALL CODE FOR THE MENUS AND POPUPS SNIPPETS *!* Replace all code with '(m.cMenuName)' with '(m.cMenuName)'>Hi all,