Make disabling submenus work in wxMSW.

As submenu items don't have a valid ID, we need to address them by their
position when calling EnableMenuItem() -- and for simplicity do it for all the
items.

Closes #16747.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-12-27 14:24:40 +00:00
parent 1b0d09e5be
commit 9bd2b4be51

View File

@@ -563,11 +563,12 @@ void wxMenuItem::Enable(bool enable)
if ( m_isEnabled == enable )
return;
if ( m_parentMenu )
const int itemPos = MSGetMenuItemPos();
if ( itemPos != -1 )
{
long rc = EnableMenuItem(GetHMenuOf(m_parentMenu),
GetMSWId(),
MF_BYCOMMAND |
itemPos,
MF_BYPOSITION |
(enable ? MF_ENABLED : MF_GRAYED));
if ( rc == -1 )