Yet another fix to event propagation in scrolled windows.

Calling ProcessEventLocally() didn't work because the command events were not
propagated to the parent window any more, breaking a lot of things including
wxDataViewCtrl event generation in the generic version. So do restore
ProcessEvent() call but use it on the next handler (i.e. the window itself)
and not this one now. This still results in some duplicate calls but at least
the events should be passed everywhere where they are expected to arrive.

wxScrollHelperEvtHandler must die.

Closes #12078.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-05-21 12:07:45 +00:00
parent 74035a191b
commit 52212bcb4a
2 changed files with 30 additions and 8 deletions

View File

@@ -264,20 +264,27 @@ void EventPropagationTestCase::WindowWithHandler()
void EventPropagationTestCase::ScrollWindowWithoutHandler()
{
TestScrollWindow * const
win = new TestScrollWindow(wxTheApp->GetTopWindow());
wxON_BLOCK_EXIT_OBJ0( *win, wxWindow::Destroy );
TestWindow * const parent = new TestWindow(wxTheApp->GetTopWindow(), 'p');
wxON_BLOCK_EXIT_OBJ0( *parent, wxWindow::Destroy );
TestScrollWindow * const win = new TestScrollWindow(parent);
wxPaintEvent event(win->GetId());
win->ProcessWindowEvent(event);
CPPUNIT_ASSERT_EQUAL( "PD", g_str );
g_str.clear();
wxCommandEvent eventCmd(TEST_EVT);
win->HandleWindowEvent(eventCmd);
CPPUNIT_ASSERT_EQUAL( "apA", g_str );
}
void EventPropagationTestCase::ScrollWindowWithHandler()
{
TestScrollWindow * const
win = new TestScrollWindow(wxTheApp->GetTopWindow());
wxON_BLOCK_EXIT_OBJ0( *win, wxWindow::Destroy );
TestWindow * const parent = new TestWindow(wxTheApp->GetTopWindow(), 'p');
wxON_BLOCK_EXIT_OBJ0( *parent, wxWindow::Destroy );
TestScrollWindow * const win = new TestScrollWindow(parent);
TestPaintEvtHandler h('h');
win->PushEventHandler(&h);
@@ -286,5 +293,10 @@ void EventPropagationTestCase::ScrollWindowWithHandler()
wxPaintEvent event(win->GetId());
win->ProcessWindowEvent(event);
CPPUNIT_ASSERT_EQUAL( "ohPD", g_str );
g_str.clear();
wxCommandEvent eventCmd(TEST_EVT);
win->HandleWindowEvent(eventCmd);
CPPUNIT_ASSERT_EQUAL( "apA", g_str );
}