diff --git a/Src/Common/Controls/DetailControls/DataTree.cs b/Src/Common/Controls/DetailControls/DataTree.cs index 361a87e8f3..3ac3acbe52 100644 --- a/Src/Common/Controls/DetailControls/DataTree.cs +++ b/Src/Common/Controls/DetailControls/DataTree.cs @@ -1399,12 +1399,16 @@ public bool DoNotRefresh /// True to not recycle any slices. /// False to try and recycle them. /// + /// True to restore the focus slices. /// /// If the DataTree's slices call this method, they should use 'false', /// or they will be disposed when this call returns to them. + /// Update 12/2025: Passing 'false' for 'differentObject' still appears to dispose + /// all the existing slices and create new ones. It does this when called from + /// Slice.MoveField() and possibly from other or all situations. /// /// ------------------------------------------------------------------------------------ - public virtual void RefreshList(bool differentObject) + public void RefreshList(bool differentObject, bool restoreFocusSlice = false) { CheckDisposed(); if (m_fDoNotRefresh) @@ -1497,7 +1501,10 @@ public virtual void RefreshList(bool differentObject) // Scrolling the control into view needs to be done after we resume the layout. if (m_currentSlice != null) { - m_currentSlice.TakeFocus(false); + if (restoreFocusSlice) + { + m_currentSlice.TakeFocus(false); + } ScrollControlIntoView(m_currentSlice); } diff --git a/Src/Common/Controls/DetailControls/Slice.cs b/Src/Common/Controls/DetailControls/Slice.cs index 21cf02673b..89cafcd84c 100644 --- a/Src/Common/Controls/DetailControls/Slice.cs +++ b/Src/Common/Controls/DetailControls/Slice.cs @@ -2853,7 +2853,7 @@ private void MoveField(Direction dir) // Persist in the parent part (might not be the immediate parent node) Inventory.GetInventory("layouts", m_cache.ProjectId.Name) .PersistOverrideElement(PartParent(fieldRef)); - ContainingDataTree.RefreshList(true); + ContainingDataTree.RefreshList(true, true); } ///