Microsoft KB Archive/156924

= PRB: Menu with Internal Names in SDI Form Changes System Menu =

Article ID: 156924

Article Last Modified on 10/15/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q156924



SYMPTOMS
If a single-document interface (SDI), or Top-Level, form is run with its own menu, which uses Visual FoxPro's internal menu names, any modifications made to the menu in the SDI form also change the corresponding pop-up or pad in the Visual FoxPro system menu.



WORKAROUND
Issue the following command after the SDI form is closed: SET SYSMENU TO DEFAULT

-or-

Do not use internal menu names.



STATUS
This behavior is by design.



MORE INFORMATION
This behavior occurs because there is only one System menu. If the menu code used in your SDI form is doing an explicit DEFINE POPUP _mfile, which redefines the File menu--a Quick menu does this--the definition supersedes any existing definition of the File menu, regardless of whether the System menu appears in an SDI form or the Visual FoxPro desktop. In Visual FoxPro version 5.0, you can use System menus in SDI forms as well as on the Visual FoxPro desktop. If internal System menu names are used in a menu definition, the system menu changes, regardless of where it appears, after that menu definition becomes effective.

Steps to Reproduce Behavior
 Create a form called Test . Set the form's ShowWindow property to 2 in the Form Designer Property window.  In the Init method of the form, add the following code: DO TESTMENU.MPR WITH This, .T.                        Create a new menu. Make it a Menu rather than a Shortcut. On the Menu menu, click Quick Menu to create a default quick menu. On the View menu, click General Options. In the General Options dialog box, click the Top-Level Form check box, then OK.</li> In the Menu Designer, click the File prompt, then the Edit button.</li> With New under Prompt selected, click on the Result drop-down list. Click Command. Click Yes in the Delete Bar Number dialog box.</li>  Tab to the empty text box to the right of the Result box, type the following, then press enter: =MESSAGEBOX('From SDI Menu',0) </li> On the Menu menu, click Generate. Save the menu as Testmenu, then select the Generate button to generate the default .mpr file.</li> Run the Test form. On the SDI form, click File then New from the menu. The message box appears; click OK to close it.</li> Click the Close button [X] in the upper right corner of the form under Windows 95 or NT 4.0, or select Alt+F4 or Close from the control menu to close the SDI form.</li> On the File menu, click New. The message box again appears. Typing SET SYSMENU TO DEFAULT in the Command window restores the default menu functionality.</li></ol>