Reset field ids after re-ordering.

We use the id for sorting the multivector.

Fixes https://gitlab.com/kicad/code/kicad/issues/8031
This commit is contained in:
Jeff Young 2021-03-26 23:25:28 +00:00
parent a0a5e93782
commit 15e640b5fe
1 changed files with 4 additions and 0 deletions

View File

@ -297,6 +297,9 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
if( !wxDialog::TransferDataFromWindow() ) if( !wxDialog::TransferDataFromWindow() )
return false; return false;
if( !m_grid->CommitPendingChanges() )
return false;
// We need to keep the name and the value the same at the moment! // We need to keep the name and the value the same at the moment!
wxString newName = m_fields->at( VALUE_FIELD ).GetText(); wxString newName = m_fields->at( VALUE_FIELD ).GetText();
wxString oldName = m_libEntry->GetName(); wxString oldName = m_libEntry->GetName();
@ -329,6 +332,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
wxPoint pos = m_fields->at( i ).GetPosition(); wxPoint pos = m_fields->at( i ).GetPosition();
pos.y = -pos.y; pos.y = -pos.y;
m_fields->at( i ).SetPosition( pos ); m_fields->at( i ).SetPosition( pos );
m_fields->at( i ).SetId( i );
} }
m_libEntry->SetFields( *m_fields ); m_libEntry->SetFields( *m_fields );