From e2a76bdb3aca1f99fde70592377317348306e2f5 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 28 Feb 2023 16:18:17 +0000 Subject: [PATCH] C2023-005: Search for annotations, delete causes reposition to first list item C2023-004: Multiple tabs, closing one repositions to first rather than active --- PROMS/Volian.Controls.Library/DisplaySearch.cs | 10 +++++++++- PROMS/Volian.Controls.Library/DisplayTabControl.cs | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index 364b43f1..6d8132df 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -939,11 +939,18 @@ namespace Volian.Controls.Library if (unitPrefix.EndsWith("#")) 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); DisplayResults(); + UpdatedAnnotationList = true; + lbSrchResults.SelectedIndex = curindx < 0 ? -1 : curindx - 1; + UpdatedAnnotationList = false; } - + private bool UpdatedAnnotationList = false; #endregion #region (ContextMenu) @@ -1730,6 +1737,7 @@ namespace Volian.Controls.Library { if (_LoadingList) return; if (_ProcessingSelectedValueChanged) return; + if (UpdatedAnnotationList) return; _ProcessingSelectedValueChanged = true; // 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) diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs index 8855adc1..82f08177 100644 --- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs +++ b/PROMS/Volian.Controls.Library/DisplayTabControl.cs @@ -826,6 +826,9 @@ namespace Volian.Controls.Library } 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) { 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; public DisplayTabItem SelectedDisplayTabItem { @@ -974,6 +984,7 @@ namespace Volian.Controls.Library { if (_SelectedDisplayTabItem != null && _SelectedDisplayTabItem.MyDSOTabPanel != null) _SelectedDisplayTabItem.MyDSOTabPanel.InActive(); + _lastSelectedDisplayTabItem = _SelectedDisplayTabItem; _SelectedDisplayTabItem = value; OnSelectedDisplayTabItemChanged(this, new EventArgs()); }