Fix setting the label for already existing menu items with bitmaps in wxMSW.
Do update the label at Windows level if we don't use MF_OWNERDRAW style, checking for IsOwnerDrawn() is wrong because the flag it tests may be set even if the item is not really owner drawn from Windows point of view. This is a mess and setting the bitmap for the existing items is still broken, but at least setting the label works now. See #9388. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76044 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
279bf9e545
commit
4c152f466f
@ -673,7 +673,11 @@ void wxMenuItem::SetItemLabel(const wxString& txt)
|
||||
|
||||
const UINT id = GetMSWId();
|
||||
HMENU hMenu = GetHMenuOf(m_parentMenu);
|
||||
if ( !hMenu || ::GetMenuState(hMenu, id, MF_BYCOMMAND) == (UINT)-1 )
|
||||
if ( !hMenu )
|
||||
return;
|
||||
|
||||
const UINT state = ::GetMenuState(hMenu, id, MF_BYCOMMAND);
|
||||
if ( state == (UINT)-1 )
|
||||
return;
|
||||
|
||||
// update the text of the native menu item
|
||||
@ -708,7 +712,11 @@ void wxMenuItem::SetItemLabel(const wxString& txt)
|
||||
// items however as otherwise their size wouldn't be recalculated as
|
||||
// WM_MEASUREITEM wouldn't be sent and this could result in display
|
||||
// problems if the length of the menu item changed significantly.
|
||||
if ( !IsOwnerDrawn() )
|
||||
//
|
||||
// Also notice that we shouldn't use our IsOwnerDrawn() because it can be
|
||||
// true because it was set by e.g. SetBitmap(), even if the item wasn't
|
||||
// made owner drawn at Windows level.
|
||||
if ( !(state & MF_OWNERDRAW) )
|
||||
#endif // wxUSE_OWNER_DRAWN
|
||||
{
|
||||
if ( isLaterThanWin95 )
|
||||
|
Loading…
Reference in New Issue
Block a user