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:
@@ -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 )
|
||||
|
Reference in New Issue
Block a user