Keep focus on filter boxes in footprint viewer

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4884
This commit is contained in:
Jon Evans 2021-03-14 15:10:04 -04:00
parent a1b4bcc210
commit 52e2bf0000
1 changed files with 14 additions and 2 deletions

View File

@ -630,6 +630,8 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& aEvent )
if( getCurNickname() == name ) if( getCurNickname() == name )
return; return;
bool filterFocus = m_libFilter->HasFocus();
setCurNickname( name ); setCurNickname( name );
ReCreateFootprintList(); ReCreateFootprintList();
@ -639,6 +641,10 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& aEvent )
// to navigate inside the list. // to navigate inside the list.
// the gal canvas must not steal the focus to allow navigation // the gal canvas must not steal the focus to allow navigation
GetCanvas()->SetStealsFocus( false ); GetCanvas()->SetStealsFocus( false );
if( filterFocus )
m_libFilter->SetFocus();
else
m_libList->SetFocus(); m_libList->SetFocus();
} }
@ -653,6 +659,8 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& aEvent )
if( ii < 0 ) if( ii < 0 )
return; return;
bool filterFocus = m_fpFilter->HasFocus();
wxString name = m_fpList->GetString( ii ); wxString name = m_fpList->GetString( ii );
if( getCurFootprintName().CmpNoCase( name ) != 0 ) if( getCurFootprintName().CmpNoCase( name ) != 0 )
@ -694,6 +702,10 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& aEvent )
// to navigate inside the list. // to navigate inside the list.
// the gal canvas must not steal the focus to allow navigation // the gal canvas must not steal the focus to allow navigation
GetCanvas()->SetStealsFocus( false ); GetCanvas()->SetStealsFocus( false );
if( filterFocus )
m_fpFilter->SetFocus();
else
m_fpList->SetFocus(); m_fpList->SetFocus();
} }