C2023-005: Search for annotations, delete causes reposition to first list item

C2023-004: Multiple tabs, closing one repositions to first rather than active
This commit is contained in:
Kathy Ruffing 2023-02-28 16:18:17 +00:00
parent 525c8f0650
commit e2a76bdb3a
2 changed files with 20 additions and 1 deletions

View File

@ -939,11 +939,18 @@ namespace Volian.Controls.Library
if (unitPrefix.EndsWith("#")) if (unitPrefix.EndsWith("#"))
unitPrefix = unitPrefix.Replace("#", string.Empty); unitPrefix = unitPrefix.Replace("#", string.Empty);
// C2023-005: Lose list position after delete. Save selected index to restore after & don't open the
// section after reset of index (UpdateAnnotationList setting below)
int curindx = lbSrchResults.SelectedIndex;
SearchResults = ItemInfoList.GetListFromAnnotationSearch(DVISearchList, TypeSearchList, AnnotationSearchType, cbxTextSearchAnnotation.Text, cbxCaseSensitiveAnnoText.Checked, unitPrefix); SearchResults = ItemInfoList.GetListFromAnnotationSearch(DVISearchList, TypeSearchList, AnnotationSearchType, cbxTextSearchAnnotation.Text, cbxCaseSensitiveAnnoText.Checked, unitPrefix);
DisplayResults(); DisplayResults();
UpdatedAnnotationList = true;
lbSrchResults.SelectedIndex = curindx < 0 ? -1 : curindx - 1;
UpdatedAnnotationList = false;
} }
private bool UpdatedAnnotationList = false;
#endregion #endregion
#region (ContextMenu) #region (ContextMenu)
@ -1730,6 +1737,7 @@ namespace Volian.Controls.Library
{ {
if (_LoadingList) return; if (_LoadingList) return;
if (_ProcessingSelectedValueChanged) return; if (_ProcessingSelectedValueChanged) return;
if (UpdatedAnnotationList) return;
_ProcessingSelectedValueChanged = true; _ProcessingSelectedValueChanged = true;
// B2021-004: Prevent multiple selections on the Incoming Transitions listbox (disable selections // B2021-004: Prevent multiple selections on the Incoming Transitions listbox (disable selections
// for the listbox until all processing is done, listbox is enabled at end of method) // for the listbox until all processing is done, listbox is enabled at end of method)

View File

@ -826,6 +826,9 @@ namespace Volian.Controls.Library
} }
private DisplayTabItem FindRemainingTab(Bar myBar) private DisplayTabItem FindRemainingTab(Bar myBar)
{ {
// C2023-004: Proms reverts to first tab rather than active tab/save last selected tab is and use to reset to it
if (LastSelectedDisplayTabItem != null && !_RemovedDisplayTabItems.Contains(LastSelectedDisplayTabItem))
return LastSelectedDisplayTabItem;
foreach (DisplayTabItem itm in myBar.Items) foreach (DisplayTabItem itm in myBar.Items)
{ {
if (!_RemovedDisplayTabItems.Contains(itm)) return itm; if (!_RemovedDisplayTabItems.Contains(itm)) return itm;
@ -963,6 +966,13 @@ namespace Volian.Controls.Library
} }
} }
} }
// C2023-004: Proms reverts to first tab rather than active tab/save last selected tab is and use to reset to it
private DisplayTabItem _lastSelectedDisplayTabItem;
public DisplayTabItem LastSelectedDisplayTabItem
{
get { return _lastSelectedDisplayTabItem; }
set { _lastSelectedDisplayTabItem = value; }
}
private DisplayTabItem _SelectedDisplayTabItem = null; private DisplayTabItem _SelectedDisplayTabItem = null;
public DisplayTabItem SelectedDisplayTabItem public DisplayTabItem SelectedDisplayTabItem
{ {
@ -974,6 +984,7 @@ namespace Volian.Controls.Library
{ {
if (_SelectedDisplayTabItem != null && _SelectedDisplayTabItem.MyDSOTabPanel != null) if (_SelectedDisplayTabItem != null && _SelectedDisplayTabItem.MyDSOTabPanel != null)
_SelectedDisplayTabItem.MyDSOTabPanel.InActive(); _SelectedDisplayTabItem.MyDSOTabPanel.InActive();
_lastSelectedDisplayTabItem = _SelectedDisplayTabItem;
_SelectedDisplayTabItem = value; _SelectedDisplayTabItem = value;
OnSelectedDisplayTabItemChanged(this, new EventArgs()); OnSelectedDisplayTabItemChanged(this, new EventArgs());
} }