Send generic wxListCtrl wxEVT_COMMAND_LIST_KEY_DOWN events from OnKeyDown rather than OnChar. Also remove the HasCurrent check. These changes bring the generic control into line with the control under wxMSW. Re-enable the previously failing unit test and document that the key down event might not have a valid item associated with it.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2682,6 +2682,16 @@ void wxListMainWindow::OnKeyDown( wxKeyEvent &event )
|
||||
if (parent->GetEventHandler()->ProcessEvent( ke ))
|
||||
return;
|
||||
|
||||
// send a list event
|
||||
wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, parent->GetId() );
|
||||
le.m_itemIndex = m_current;
|
||||
if (HasCurrent())
|
||||
GetLine(m_current)->GetItem( 0, le.m_item );
|
||||
le.m_code = event.GetKeyCode();
|
||||
le.SetEventObject( parent );
|
||||
if (parent->GetEventHandler()->ProcessEvent( le ))
|
||||
return;
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
@@ -2701,17 +2711,6 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
||||
{
|
||||
wxWindow *parent = GetParent();
|
||||
|
||||
// send a list_key event up
|
||||
if ( HasCurrent() )
|
||||
{
|
||||
wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
|
||||
le.m_itemIndex = m_current;
|
||||
GetLine(m_current)->GetItem( 0, le.m_item );
|
||||
le.m_code = event.GetKeyCode();
|
||||
le.SetEventObject( parent );
|
||||
parent->GetEventHandler()->ProcessEvent( le );
|
||||
}
|
||||
|
||||
// propagate the char event upwards
|
||||
wxKeyEvent ke(event);
|
||||
ke.SetEventObject( parent );
|
||||
|
Reference in New Issue
Block a user