Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Src/Common/Controls/XMLViews/BulkEditBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -437,6 +438,7 @@ public void UpdateColumnList()
m_operationsTabControl_SelectedIndexChanged(this, new EventArgs());
m_hvoSelected = oldSelected;
ResumeRecordListRowChanges();
PostUpdateColumnList();
}

/// <summary>
Expand Down Expand Up @@ -1748,6 +1750,26 @@ protected virtual void ShowPreviewItems(ProgressState state)
XMLViewsDataCache.ktagItemEnabled, state);
}

/// <summary>
/// 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.
/// </summary>
protected virtual void PreUpdateColumnList()
{

}

/// <summary>
/// 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.
/// </summary>
protected virtual void PostUpdateColumnList()
{

}

internal void ClearPreview()
{
HandlePreviewOrSuggestTask(DoClearPreviewTask);
Expand Down
37 changes: 37 additions & 0 deletions Src/FdoUi/PhonologicalFeatureEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ private bool IsItemEligible(ISilDataAccess sda, int hvo, ICmObject selectedObjec
/// </summary>
public class BulkEditBarPhonologicalFeatures : BulkEditBar
{
private string m_currentFeatDefnAbbr = null;
private int m_currentSelectedHvo = 0;

/// ------------------------------------------------------------------------------------
/// <summary>
/// Create one
Expand Down Expand Up @@ -755,6 +758,40 @@ protected override void ShowPreviewItems(ProgressState state)
}
}
}

/// <summary>
/// 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.
/// </summary>
protected override void PreUpdateColumnList()
{
BulkEditItem bei = m_beItems[m_itemIndex];
if (bei.BulkEditControl is PhonologicalFeatureEditor phonFeatEditor)
{
m_currentFeatDefnAbbr = phonFeatEditor.FeatDefnAbbr;
m_currentSelectedHvo = phonFeatEditor.SelectedHvo;
}
}

/// <summary>
/// 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.
/// </summary>
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)
Expand Down
Loading