Forward key down/up events from wxCompositeWindow children too
There doesn't seem to be any reason to only forward CHAR events, but not KEY_{DOWN,UP} ones, so do the same thing for the latter ones too. This allows to get rid of GetMainWindow() call in wxDataViewCtrl unit tests, as wxEVT_KEY_DOWN are now correctly received in the control itself and not just its main window.
This commit is contained in:
parent
3ed930c736
commit
f16b502f66
@ -218,10 +218,14 @@ private:
|
|||||||
win = win->GetParent();
|
win = win->GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
child->Bind(wxEVT_CHAR, &wxCompositeWindow::OnChar, this);
|
// Make all keyboard events occurring in sub-windows appear as coming
|
||||||
|
// from the main window itself.
|
||||||
|
child->Bind(wxEVT_KEY_DOWN, &wxCompositeWindow::OnKeyEvent, this);
|
||||||
|
child->Bind(wxEVT_CHAR, &wxCompositeWindow::OnKeyEvent, this);
|
||||||
|
child->Bind(wxEVT_KEY_UP, &wxCompositeWindow::OnKeyEvent, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnChar(wxKeyEvent& event)
|
void OnKeyEvent(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
wxEventObjectOriginSetter setThis(event, this, this->GetId());
|
wxEventObjectOriginSetter setThis(event, this, this->GetId());
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ TEST_CASE_METHOD(SingleSelectDataViewCtrlTestCase,
|
|||||||
if ( !EnableUITests() )
|
if ( !EnableUITests() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EventCounter keyEvents(m_dvc->GetMainWindow(), wxEVT_KEY_DOWN);
|
EventCounter keyEvents(m_dvc, wxEVT_KEY_DOWN);
|
||||||
|
|
||||||
m_dvc->SetFocus();
|
m_dvc->SetFocus();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user