Support tabbing to non-text controls on non-Mac platforms.

Fixes: lp:1840991
* https://bugs.launchpad.net/kicad/+bug/1840991
This commit is contained in:
Jeff Young 2019-08-23 22:14:12 +01:00
parent 820c2d2722
commit f21467e340
2 changed files with 22 additions and 8 deletions

View File

@ -500,23 +500,34 @@ void DIALOG_SHIM::OnCharHook( wxKeyEvent& aEvt )
int currentIdx = -1;
int delta = aEvt.ShiftDown() ? -1 : 1;
auto advance = [&]( int& idx )
{
idx += delta;
if( idx < 0 )
idx = m_tabOrder.size() - 1;
else if ( idx >= m_tabOrder.size() )
idx = 0;
};
for( size_t i = 0; i < m_tabOrder.size(); ++i )
{
if( m_tabOrder[i] == currentWindow )
{
currentIdx = (int) i + delta;
if( currentIdx < 0 )
currentIdx = m_tabOrder.size() - 1;
else if ( currentIdx >= m_tabOrder.size() )
currentIdx = 0;
currentIdx = (int) i;
break;
}
}
if( currentIdx >= 0 )
{
advance( currentIdx );
#ifdef __APPLE__
while( dynamic_cast<wxTextEntry*>( m_tabOrder[ currentIdx ] ) == nullptr )
advance( currentIdx );
#endif
m_tabOrder[ currentIdx ]->SetFocus();
return;
}

View File

@ -72,7 +72,10 @@ DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( LIB_EDIT_FRAME* parent, LIB_PIN* aPin
m_choiceOrientation,
m_pinLengthCtrl,
m_nameSizeCtrl,
m_numberSizeCtrl
m_numberSizeCtrl,
m_checkApplyToAllParts,
m_checkApplyToAllConversions,
m_checkShow
};
m_sdbSizerButtonsOK->SetDefault();