diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index 300f4b427b..8f67565503 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -295,11 +295,6 @@ bool DIALOG_SIM_MODEL::TransferDataFromWindow() { m_pinAssignmentsGrid->CommitPendingChanges(); - // This should have been done in wxPGTextCtrlEditor::OnTextCtrlEvent(), but something must - // be clearing it before we get here, resulting in CommitChangesFromEditor() doing nothing - m_paramGrid->GetGrid()->EditorsValueWasModified(); - m_paramGrid->GetGrid()->CommitChangesFromEditor(); - if( !DIALOG_SIM_MODEL_BASE::TransferDataFromWindow() ) return false; @@ -1241,11 +1236,6 @@ void DIALOG_SIM_MODEL::onTypeChoice( wxCommandEvent& aEvent ) template void DIALOG_SIM_MODEL::onPageChanging( wxBookCtrlEvent& event ) { - // This should have been done in wxPGTextCtrlEditor::OnTextCtrlEvent(), but something must - // be clearing it before we get here, resulting in CommitChangesFromEditor() doing nothing - m_paramGrid->GetGrid()->EditorsValueWasModified(); - m_paramGrid->GetGrid()->CommitChangesFromEditor(); - updateModelCodeTab( &curModel() ); } @@ -1295,10 +1285,7 @@ void DIALOG_SIM_MODEL::onParamGridSetFocus( wxFocusEvent& aEv // Tab key is pressed. This is inconvenient, so we fix that here. wxPropertyGrid* grid = m_paramGrid->GetGrid(); - - grid->CommitChangesFromEditor(); - - wxPGProperty* selected = grid->GetSelection(); + wxPGProperty* selected = grid->GetSelection(); if( !selected ) selected = grid->wxPropertyGridInterface::GetFirst(); @@ -1315,8 +1302,6 @@ void DIALOG_SIM_MODEL::onParamGridSelectionChange( wxProperty { wxPropertyGrid* grid = m_paramGrid->GetGrid(); - grid->CommitChangesFromEditor(); - // Jump over categories. if( grid->GetSelection() && grid->GetSelection()->IsCategory() ) { @@ -1395,10 +1380,7 @@ void DIALOG_SIM_MODEL::onUpdateUI( wxUpdateUIEvent& aEvent ) wxRect gridRect = grid->GetScreenRect(); if( ctrlRect.GetTop() < gridRect.GetTop() || ctrlRect.GetBottom() > gridRect.GetBottom() ) - { - grid->CommitChangesFromEditor(); grid->ClearSelection(); - } } #endif } diff --git a/eeschema/sim/sim_property.cpp b/eeschema/sim/sim_property.cpp index 0ae6299699..24df31f0c5 100644 --- a/eeschema/sim/sim_property.cpp +++ b/eeschema/sim/sim_property.cpp @@ -134,6 +134,21 @@ bool SIM_STRING_PROPERTY::OnEvent( wxPropertyGrid* propgrid, wxWindow* wnd_prima } } + if( wxPropertyGrid* propGrid = dynamic_cast( wnd_primary->GetParent() ) ) + { + // This doesn't seem like it should be required, as wxPGTextCtrlEditor::OnTextCtrlEvent() + // should be setting the value to modified. But it doesn't (or the modified flag is + // cleared at some point later), and even if it is set, the changes don't get committed. + // (We used to have code in DIALOG_SIM_MODEL to commit things on *some* actions, but it + // wasn't complete and this appears to have at least a better hit rate.) + propGrid->CallAfter( + [propGrid]() + { + propGrid->EditorsValueWasModified(); + propGrid->CommitChangesFromEditor(); + } ); + } + return false; }