library viewers: fix a focus issue that prevent using arrow keys in lib or fp lists.

Once the gal canvas hsad the focus, it was not possible to use arrow keys in library
or symbols or fp lists even after clicking on an item.

This focus issue is now fixed.

Fixes #4292
https://gitlab.com/kicad/code/kicad/issues/4292
This commit is contained in:
jean-pierre charras 2020-05-03 20:11:33 +02:00
parent 63291141df
commit 05afbcc22e
2 changed files with 22 additions and 0 deletions

View File

@ -558,6 +558,11 @@ void LIB_VIEW_FRAME::SetSelectedLibrary( const wxString& aLibraryName )
// (which is not necessary the case if SetSelectedLibrary is called
// by another caller than ClickOnLibList.
m_libList->SetStringSelection( m_libraryName, true );
// The m_libList has now the focus, in order to be able to use arrow keys
// to navigate inside the list.
// the gal canvas must not steal the focus to allow navigation
GetCanvas()->SetStealsFocus( false );
m_libList->SetFocus();
}
@ -572,6 +577,11 @@ void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event )
m_selection_changed = true;
SetSelectedComponent( m_cmpList->GetString( ii ) );
// The m_cmpList has now the focus, in order to be able to use arrow keys
// to navigate inside the list.
// the gal canvas must not steal the focus to allow navigation
GetCanvas()->SetStealsFocus( false );
m_cmpList->SetFocus();
}

View File

@ -580,6 +580,12 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& aEvent )
ReCreateFootprintList();
UpdateTitle();
// The m_libList has now the focus, in order to be able to use arrow keys
// to navigate inside the list.
// the gal canvas must not steal the focus to allow navigation
GetCanvas()->SetStealsFocus( false );
m_libList->SetFocus();
}
@ -629,6 +635,12 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& aEvent )
GetCanvas()->Refresh();
Update3DView( true );
}
// The m_fpList has now the focus, in order to be able to use arrow keys
// to navigate inside the list.
// the gal canvas must not steal the focus to allow navigation
GetCanvas()->SetStealsFocus( false );
m_fpList->SetFocus();
}