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/branches/WX_3_0_BRANCH@78323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-12-27 14:17:51 +00:00
parent 7a8cfc7964
commit e91a996fa4
2 changed files with 5 additions and 3 deletions

View File

@@ -599,6 +599,7 @@ wxMSW:
- Fix size of the icon returned from wxFSVolume::GetIcon() (troelsk).
- Fix autosize after expanding/collapsing items in wxDataViewCtrl (ciglesias).
- Fix inserting tools removed from wxToolBar back into it (sbrowne).
- Fix disabling submenu items in the menus (Artur Wieczorek).
3.0.2: (released 2014-10-06)

View File

@@ -557,11 +557,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 )