From: Robert Roebling Date: Wed, 19 May 1999 10:46:48 +0000 (+0000) Subject: Listctrl should now send char and key_down events. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3dfb93fd8225558306cb41fd6f4b1a2516859565 Listctrl should now send char and key_down events. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2510 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index c18b4a781f..5ab34cb26c 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -481,6 +481,7 @@ class WXDLLEXPORT wxListMainWindow: public wxScrolledWindow void MoveToFocus( void ); void OnArrowChar( wxListLineData *newCurrent, bool shiftDown ); void OnChar( wxKeyEvent &event ); + void OnKeyDown( wxKeyEvent &event ); void OnSetFocus( wxFocusEvent &event ); void OnKillFocus( wxFocusEvent &event ); void OnSize( wxSizeEvent &event ); diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 2ed58de9aa..e319bca803 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -942,6 +942,7 @@ BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledWindow) EVT_SIZE (wxListMainWindow::OnSize) EVT_MOUSE_EVENTS (wxListMainWindow::OnMouse) EVT_CHAR (wxListMainWindow::OnChar) + EVT_KEY_DOWN (wxListMainWindow::OnKeyDown) EVT_SET_FOCUS (wxListMainWindow::OnSetFocus) EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus) END_EVENT_TABLE() @@ -1381,6 +1382,25 @@ void wxListMainWindow::OnArrowChar( wxListLineData *newCurrent, bool shiftDown ) UnfocusLine( oldCurrent ); } +void wxListMainWindow::OnKeyDown( wxKeyEvent &event ) +{ + wxWindow *parent = GetParent(); + + /* we propagate the key event up */ + wxKeyEvent ke( wxEVT_KEY_DOWN ); + ke.m_shiftDown = event.m_shiftDown; + ke.m_controlDown = event.m_controlDown; + ke.m_altDown = event.m_altDown; + ke.m_metaDown = event.m_metaDown; + ke.m_keyCode = event.m_keyCode; + ke.m_x = event.m_x; + ke.m_y = event.m_y; + ke.SetEventObject( parent ); + if (parent->GetEventHandler()->ProcessEvent( ke )) return; + + event.Skip(); +} + void wxListMainWindow::OnChar( wxKeyEvent &event ) { wxWindow *parent = GetParent(); @@ -1391,8 +1411,8 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) le.SetEventObject( parent ); parent->GetEventHandler()->ProcessEvent( le ); - /* we propagate the key event up */ - wxKeyEvent ke( wxEVT_KEY_DOWN ); + /* we propagate the char event up */ + wxKeyEvent ke( wxEVT_CHAR ); ke.m_shiftDown = event.m_shiftDown; ke.m_controlDown = event.m_controlDown; ke.m_altDown = event.m_altDown;