Fix check for the item being checked when appending it under wxMSW.

The changes of r75448 were wrong, we can't ask Windows for the item state
before attaching it to the menu, so just check the internal flag here.

See ##15748.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75570 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-01-07 21:54:51 +00:00
parent d14879f2bd
commit 98601f5646

View File

@ -529,8 +529,10 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
// Also handle the case of check menu items that had been checked before // Also handle the case of check menu items that had been checked before
// being attached to the menu: we don't need to actually call Check() on // being attached to the menu: we don't need to actually call Check() on
// them, so we don't use checkInitially in this case, but we do need to // them, so we don't use checkInitially in this case, but we do need to
// make them checked at Windows level too. // make them checked at Windows level too. Notice that we shouldn't ask
if ( pItem->IsCheck() && pItem->IsChecked() ) // Windows for the checked state here, as wxMenuItem::IsChecked() does, as
// the item is not attached yet, so explicitly call the base class version.
if ( pItem->IsCheck() && pItem->wxMenuItemBase::IsChecked() )
flags |= MF_CHECKED; flags |= MF_CHECKED;
// adjust position to account for the title of a popup menu, if any // adjust position to account for the title of a popup menu, if any