Microsoft KB Archive/163406

{|
 * width="100%"|

PRB: Menu Pads and Bars Do Not Disable Properly on SDI Form
'Article ID: Q163406

Creation Date: 10-FEB-1997

Revision Date: 14-FEB-1997' The information in this article applies to:


 * Microsoft Visual FoxPro for Windows, version 5.0

SYMPTOMS

Menu pads and the menu bars on those menu pads do not disable properly and then do not re-enable when changing the SKIP FOR setting when the menu is placed in an SDI form. In the case of menu pad bars, when the SKIP FOR setting is changed to true, the bar will not disable (turn gray) until the second time it is chosen. However, the command or procedure assigned to that bar will not run. In the case of the menu pad, it also does not disable until the second time it is chosen. However, even though the menu will drop down, the options on it will not function.

RESOLUTION

Press the ALT key to re-enable the menu pad once the SKIP FOR expression evaluates to True. If an option on the menu pad has been disabled, the only known way to re-enable it is to disable the pad, re-enable the bar and then the pad (the SKIP FOR expressions should both evaluate to True), and then press the ALT key. When the menu pad re-enables, the bar does also.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

When designing a menu in the Menu Designer, a logical memory variable can be placed in the SKIP FOR expression in the Prompt Options dialog box. The logical values .T. or .F. can also be used for this expression but they cannot be changed at runtime and this problem still occurs.

Steps to Reproduce Behavior

The following steps to reproduce the behavior assume a working knowledge of the Menu Designer and Form Designer in Visual FoxPro:

  Create a new program file and save it as NoDisabl.prg. Place the following code in the program file, and then save and close it: xx=.F.     yy=.F.      DO FORM NoDisabl READ EVENTS  Create a new menu in the Menu Designer. At the prompt for the first menu pad, type "Pad1." Make the result a Submenu. Click the Options button and place "xx" in the Skip For box that should be in the Prompt Options dialog box that comes up when the Options button is clicked. Choose OK to exit the Prompt Options dialog box. Choose the Create button to create the Submenu.  To create two menu bar prompts, type "Bar1" and "Bar2." Make the result of each a command. For the commands, enter: WAIT WINDOW "Bar 1" -and- WAIT WINDOW "Bar 2"  Click the Options button for Bar1. In the Prompt Options dialog box, place "yy" in the Skip For box. Choose OK to exit the Prompt Options dialog box. From the View menu, choose the General Options command. Check the Top-Level Form checkbox in the General Options dialog box. Choose the Generate command from the Menu, and then save and generate the menu. Name the menu files "NoDisabl.mnx" and "NoDisabl.mpr."</li> Create a new form.</li>  In the Init method of the form, place the following code: DO NoDisabl.mpr WITH THIS, .T. </li>  In the Destroy method of the form, place the following code: RELEASE MENU (THIS.Name) EXTENDED </li> Place three Command Buttons on the form. Change the caption properties on the buttons to Quit, Toggle Disable Menu, and Toggle Disable Menu Bar.</li>  In the Click method of the Quit button, place the following code: CLEAR EVENTS Thisform.release </li>  In the Click method of the Toggle Disable Menu, place the following code: xx=!xx IF xx WAIT WINDOW "xx is True, the pad should be disabled" ELSE WAIT WINDOW "xx is False, the pad should be reenabled" ENDIF Thisform.refresh </li>  In the Click method of the Toggle Disable Menu Bar, place the following code: yy=!yy IF yy WAIT WINDOW "yy is True, menu bar 1 should be disabled" ELSE WAIT WINDOW "yy is False, menu bar 1 should be reenabled" ENDIF Thisform.refresh </li> Set the ShowWindow property of the form to be 2 - As Top-Level Form.</li> Save the form as NoDisabl.scx and close it.</li>  Issue the following command in the Visual FoxPro Command window: DO NoDisable.prg </li> Pull down the menu (use the mouse for this and the following steps) and make sure the options work.</li> Click the Toggle Disable Menu Bar button, note the WAIT WINDOW that appears. Pull down the menu and choose Bar 1. Note that it is not disabled (gray) but the WAIT WINDOW does not appear. Pull down the menu again. The Bar 1 option should now be disabled (gray). Click the Toggle Disable Menu Bar button again and pull down the menu. Note that Bar 1 is still disabled.</li> Click on the Toggle Disable Menu button. Note the WAIT WINDOW and pull down the menu. Notice that it is not disabled but the Bar 2 option doesn't bring up its WAIT WINDOW. Click on the menu pad again. It should immediately disable. Click the Toggle Disable Menu button again. Note that the menu pad does not re-enable.</li> The menu pad should now be re-enabled but the mouse can't get it to work. Press the ALT key and click the menu pad. It should now be re-enabled and the Bar 2 option should work.</li>  To see the menu work as expected outside the form, undo the following or recreate the example without the following: - Step #7 - uncheck the Top-Level form and be sure to regenerate the menu. - Steps #10, 11 - remark out these lines of code. - Step #16 - set the ShowWindow property of the form to 0 - In Screen. - Add the following line of code to the NoDisabl.prg file just before the DO FORM NoDisabl line: DO NoDisabl.mpr - In the NoDisabl.prg file, place SET SYSMENU TO DEFAULT after the CLEAR EVENTS command. When you run the NoDisabl program, the menu should work as expected. The Pad will not show as enabled or disabled until you click on it once or press the ALT key. </li></ol>
 * }

-

<span style="font-family:verdana,arial,helvetica; font-size:8pt"> KBCategory: kbprg kbprb

KBSubcategory: FxtoolFormdes FxprgGeneral vfoxwin

Additional reference words: 5.00

"THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED 'AS IS' WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY." '' ©1997 Microsoft Corporation. All rights reserved. Legal Notices.

''