Don't allow preview canvases to steal focus when keyboard navigating preferences tree.

Fixes https://gitlab.com/kicad/code/kicad/issues/10407
This commit is contained in:
Jeff Young 2022-09-10 20:10:39 +01:00
parent 6eb7c176a7
commit 52ea9d0bc5
1 changed files with 10 additions and 3 deletions

View File

@ -335,9 +335,6 @@ void PAGED_DIALOG::onCharHook( wxKeyEvent& aEvent )
{
if( aEvent.GetKeyCode() == WXK_UP )
{
// We have to special-case WXK_UP as when wxWidgets attempts to select the header we'll
// go down to its first child again.
int page = m_treebook->GetSelection();
if( page >= 1 )
@ -347,6 +344,16 @@ void PAGED_DIALOG::onCharHook( wxKeyEvent& aEvent )
else
m_treebook->SetSelection( page - 1 );
}
m_treebook->GetTreeCtrl()->SetFocus(); // Don't allow preview canvas to steal focus
}
else if( aEvent.GetKeyCode() == WXK_DOWN )
{
int page = m_treebook->GetSelection();
m_treebook->SetSelection( std::min<int>( page + 1, m_treebook->GetPageCount() - 1 ) );
m_treebook->GetTreeCtrl()->SetFocus(); // Don't allow preview canvas to steal focus
}
else
{