Pass menu events to the handler in the associated menu bar.

We handled the menu events in the menu itself and the associated window, but
not in the menu bar that the menu belonged to. This was unexpected, so allow
handling the events in the menu bar itself too.

Closes #15095.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73922 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-05-04 23:59:32 +00:00
parent 3bad8c3926
commit 4ed3f4abd8
3 changed files with 21 additions and 6 deletions

View File

@@ -400,10 +400,18 @@ void EventPropagationTestCase::MenuEvent()
CheckMenuEvent( menu, "aomA" );
// Test that the event handler associated with the menu bar gets the event.
TestMenuEvtHandler hb('b'); // 'b' for "menu Bar"
mb->PushEventHandler(&hb);
wxON_BLOCK_EXIT_OBJ1( *mb, wxWindow::PopEventHandler, false );
CheckMenuEvent( menu, "aomobA" );
// Also test that the window to which the menu belongs gets the event.
TestMenuEvtHandler hw('w'); // 'w' for "Window"
frame->PushEventHandler(&hw);
wxON_BLOCK_EXIT_OBJ1( *frame, wxWindow::PopEventHandler, false );
CheckMenuEvent( menu, "aomowA" );
CheckMenuEvent( menu, "aomobowA" );
}