diff --git a/Src/Common/Controls/XMLViews/BulkEditBar.cs b/Src/Common/Controls/XMLViews/BulkEditBar.cs index 5ab87dbba9..83153d22bd 100644 --- a/Src/Common/Controls/XMLViews/BulkEditBar.cs +++ b/Src/Common/Controls/XMLViews/BulkEditBar.cs @@ -417,6 +417,7 @@ public void UpdateColumnList() { CheckDisposed(); + PreUpdateColumnList(); // ClickCopy.ClickCopyTabPageSettings/SaveSettings()/CommitClickChanges() // could possibly change m_hvoSelected when we're not ready, so save current. // see comment on LT-4768 below. @@ -437,6 +438,7 @@ public void UpdateColumnList() m_operationsTabControl_SelectedIndexChanged(this, new EventArgs()); m_hvoSelected = oldSelected; ResumeRecordListRowChanges(); + PostUpdateColumnList(); } /// @@ -1748,6 +1750,26 @@ protected virtual void ShowPreviewItems(ProgressState state) XMLViewsDataCache.ktagItemEnabled, state); } + /// + /// UpdateColumnList() will Dispose all the BulkEditItems and re-create them. So any + /// derived class that needs to do something before or after that should override the Pre + /// or Post method. + /// + protected virtual void PreUpdateColumnList() + { + + } + + /// + /// UpdateColumnList() will Dispose all the BulkEditItems and re-create them. So any + /// derived class that needs to do something before or after that should override the Pre + /// or Post method. + /// + protected virtual void PostUpdateColumnList() + { + + } + internal void ClearPreview() { HandlePreviewOrSuggestTask(DoClearPreviewTask); diff --git a/Src/FdoUi/PhonologicalFeatureEditor.cs b/Src/FdoUi/PhonologicalFeatureEditor.cs index 2b1a1a6887..85e95a4948 100644 --- a/Src/FdoUi/PhonologicalFeatureEditor.cs +++ b/Src/FdoUi/PhonologicalFeatureEditor.cs @@ -657,6 +657,9 @@ private bool IsItemEligible(ISilDataAccess sda, int hvo, ICmObject selectedObjec /// public class BulkEditBarPhonologicalFeatures : BulkEditBar { + private string m_currentFeatDefnAbbr = null; + private int m_currentSelectedHvo = 0; + /// ------------------------------------------------------------------------------------ /// /// Create one @@ -755,6 +758,40 @@ protected override void ShowPreviewItems(ProgressState state) } } } + + /// + /// UpdateColumnList() will Dispose all the BulkEditItems and re-create them. The + /// currently displayed PhonologicalFeatureEditor stores it's SelectedHvo. Store it + /// here so we can restore it after the new one is created. + /// + protected override void PreUpdateColumnList() + { + BulkEditItem bei = m_beItems[m_itemIndex]; + if (bei.BulkEditControl is PhonologicalFeatureEditor phonFeatEditor) + { + m_currentFeatDefnAbbr = phonFeatEditor.FeatDefnAbbr; + m_currentSelectedHvo = phonFeatEditor.SelectedHvo; + } + } + + /// + /// UpdateColumnList() will Dispose all the BulkEditItems and re-create them. The + /// currently displayed PhonologicalFeatureEditor stores it's SelectedHvo. Restore it + /// here after the new one is created. + /// + protected override void PostUpdateColumnList() + { + BulkEditItem bei = m_beItems[m_itemIndex]; + if (bei.BulkEditControl is PhonologicalFeatureEditor phonFeatEditor && + phonFeatEditor.FeatDefnAbbr == m_currentFeatDefnAbbr) + { + phonFeatEditor.SelectedHvo = m_currentSelectedHvo; + } + + m_currentFeatDefnAbbr = null; + m_currentSelectedHvo = 0; + } + protected override void Dispose(bool disposing) { if (IsDisposed)