Use the correct event handler in wxMenuBase::UpdateUI().

Use GetWindow() instead of GetInvokingWindow() to send the event to the
associated window for the menus that are part of the menu bar and not only the
popup ones. This was broken since r64127 because GetInvokingWindow() is now
only used for the popup menus.

Closes #13317.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-07-10 12:55:30 +00:00
parent e96be167e7
commit 0a63a7b38f

View File

@@ -597,17 +597,18 @@ wxMenuItem* wxMenuBase::FindItemByPosition(size_t position) const
// window will be used.
void wxMenuBase::UpdateUI(wxEvtHandler* source)
{
if (GetInvokingWindow())
wxWindow * const win = GetWindow();
if ( win )
{
// Don't update menus if the parent
// frame is about to get deleted
wxWindow *tlw = wxGetTopLevelParent( GetInvokingWindow() );
wxWindow *tlw = wxGetTopLevelParent(win);
if (tlw && wxPendingDelete.Member(tlw))
return;
}
if ( !source && GetInvokingWindow() )
source = GetInvokingWindow()->GetEventHandler();
if ( !source && win )
source = win->GetEventHandler();
if ( !source )
source = GetEventHandler();
if ( !source )