PRB: Setting Menu Items to Grayed Does Not Disable the Item (143290)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 2.2
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++ for Windows, 16-bit edition 1.51
- Microsoft Visual C++ for Windows, 16-bit edition 1.52
This article was previously published under Q143290 SYMPTOMS
If you create a popup menu item and select its Grayed property in
AppStudio, the menu item will appear Grayed in AppStudio and the GRAYED
attribute will appear in the .RC file, but the menu item may not appear
Grayed (disabled) when you run the application. The same behavior may
appear for menus with the Inactive property.
CAUSE
CFrameWnd has a member variable name m_bAutoMenuEnabled, which is described
in the Class Library reference. The documentation states that this variable
is set to TRUE by default, meaning that any menu item that has an
ON_COMMAND handler but no corresponding ON_UPDATE_COMMAND_UI handler will
be automatically enabled. This variable overrides any setting you may have
selected in your resource file.
RESOLUTION
If you would like to change this behavior, either implement the
ON_UPDATE_COMMAND_UI handler or set the value of m_bAutoMenuEnabled to
FALSE in the derived CFrameWnd constructor.
STATUS
This behavior is by design.
REFERENCES
The Class Library Reference, documentation for ON_UPDATE_COMMAND_UI and
CFrameWnd::m_bAutoMenuEnable.
Modification Type: | Major | Last Reviewed: | 12/9/2003 |
---|
Keywords: | kbMenu kbprb KbUIDesign KB143290 |
---|
|