diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index cce870cbe4..269bd56572 100644 --- a/common/dialog_shim.cpp +++ b/common/dialog_shim.cpp @@ -435,30 +435,58 @@ void DIALOG_SHIM::SaveControlState() if( !key.empty() ) { - if( m_unitBinders.contains( win ) && !m_unitBinders[ win ]->UnitsInvariant() ) - dlgMap[ key ] = m_unitBinders[ win ]->GetValue(); + if( m_unitBinders.contains( win ) ) + { + if( !m_unitBinders[ win ]->UnitsInvariant() ) + dlgMap[ key ] = m_unitBinders[ win ]->GetValue(); + } else if( wxComboBox* combo = dynamic_cast( win ) ) + { dlgMap[ key ] = combo->GetValue(); + } else if( wxOwnerDrawnComboBox* od_combo = dynamic_cast( win ) ) + { dlgMap[ key ] = od_combo->GetSelection(); + } else if( wxTextEntry* textEntry = dynamic_cast( win ) ) + { dlgMap[ key ] = textEntry->GetValue(); + } else if( wxChoice* choice = dynamic_cast( win ) ) + { dlgMap[ key ] = choice->GetSelection(); + } else if( wxCheckBox* check = dynamic_cast( win ) ) + { dlgMap[ key ] = check->GetValue(); + } else if( wxSpinCtrl* spin = dynamic_cast( win ) ) + { dlgMap[ key ] = spin->GetValue(); + } else if( wxRadioButton* radio = dynamic_cast( win ) ) + { dlgMap[ key ] = radio->GetValue(); + } else if( wxRadioBox* radioBox = dynamic_cast( win ) ) + { dlgMap[ key ] = radioBox->GetSelection(); + } else if( wxSplitterWindow* splitter = dynamic_cast( win ) ) + { dlgMap[ key ] = splitter->GetSashPosition(); + } else if( wxScrolledWindow* scrolled = dynamic_cast( win ) ) + { dlgMap[ key ] = scrolled->GetScrollPos( wxVERTICAL ); + } else if( wxNotebook* notebook = dynamic_cast( win ) ) - dlgMap[ key ] = notebook->GetPageText( notebook->GetSelection() ); + { + int index = notebook->GetSelection(); + + if( index >= 0 && index < (int) notebook->GetPageCount() ) + dlgMap[ key ] = notebook->GetPageText( notebook->GetSelection() ); + } } for( wxWindow* child : win->GetChildren() )