Fix a few wxUpdateUIEvent retrigger loops.

This commit is contained in:
Wayne Stambaugh 2021-12-13 15:46:13 -05:00
parent f844f5a80c
commit 755607b8f8
4 changed files with 6 additions and 4 deletions

View File

@ -352,8 +352,10 @@ void PAGED_DIALOG::OnUpdateUI( wxUpdateUIEvent& event )
{
unsigned next = m_treebook->GetSelection() + 1;
// Use ChangeSelection() here because SetSelection() generates page change events which
// creates an infinite wxUpdateUIEvent loop.
if( next < m_treebook->GetPageCount() )
m_treebook->SetSelection( next );
m_treebook->ChangeSelection( next );
}
}

View File

@ -750,7 +750,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
if( m_delayedFocusPage >= 0 && m_NoteBook->GetSelection() != m_delayedFocusPage )
{
m_NoteBook->SetSelection( (unsigned) m_delayedFocusPage );
m_NoteBook->ChangeSelection( (unsigned) m_delayedFocusPage );
m_delayedFocusPage = -1;
}

View File

@ -583,7 +583,7 @@ void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
if( static_cast<int>( m_delayedFocusPage ) >= 0 )
{
if( m_NoteBook->GetSelection() != static_cast<int>( m_delayedFocusPage ) )
m_NoteBook->SetSelection( static_cast<int>( m_delayedFocusPage ) );
m_NoteBook->ChangeSelection( static_cast<int>( m_delayedFocusPage ) );
m_delayedFocusPage = NOTEBOOK_PAGES::PAGE_UNKNOWN;
}

View File

@ -1086,7 +1086,7 @@ void DIALOG_PAD_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
void DIALOG_PAD_PROPERTIES::OnUpdateUINonCopperWarning( wxUpdateUIEvent& event )
{
bool isOnCopperLayer = ( m_dummyPad->GetLayerSet() & LSET::AllCuMask() ).any();
m_nonCopperWarningBook->SetSelection( isOnCopperLayer ? 0 : 1 );
m_nonCopperWarningBook->ChangeSelection( isOnCopperLayer ? 0 : 1 );
}