diff --git a/Terminal.Gui/View/Layout/ViewLayout.cs b/Terminal.Gui/View/Layout/ViewLayout.cs index eac15a153..d9909d12a 100644 --- a/Terminal.Gui/View/Layout/ViewLayout.cs +++ b/Terminal.Gui/View/Layout/ViewLayout.cs @@ -794,6 +794,7 @@ public partial class View private void LayoutSubview (View v, Size contentSize) { + // BUGBUG: Calling SetRelativeLayout before LayoutSubviews is problematic. Need to resolve. v.SetRelativeLayout (contentSize); v.LayoutSubviews (); v.LayoutNeeded = false; diff --git a/Terminal.Gui/Views/Slider.cs b/Terminal.Gui/Views/Slider.cs index aff7c9761..738913512 100644 --- a/Terminal.Gui/Views/Slider.cs +++ b/Terminal.Gui/Views/Slider.cs @@ -265,6 +265,13 @@ public class Slider : View Enter += (s, e) => { }; + // BUGBUG: This should not be needed - Need to ensure SetRelativeLayout gets called during EndInit + Initialized += (s, e) => + { + CalcSpacingConfig (); + SetContentSizeBestFit (); + }; + LayoutStarted += (s, e) => { CalcSpacingConfig (); diff --git a/UICatalog/Scenarios/ContentScrolling.cs b/UICatalog/Scenarios/ContentScrolling.cs index 249973ec4..496eac77e 100644 --- a/UICatalog/Scenarios/ContentScrolling.cs +++ b/UICatalog/Scenarios/ContentScrolling.cs @@ -27,7 +27,7 @@ public class ContentScrolling : Scenario BorderStyle = LineStyle.Rounded; Arrangement = ViewArrangement.Fixed; - ContentSize = new (10, 40); + ContentSize = new (60, 40); ViewportSettings |= ViewportSettings.ClearContentOnly; ViewportSettings |= ViewportSettings.ClipContentOnly; diff --git a/UnitTests/Views/SliderTests.cs b/UnitTests/Views/SliderTests.cs index e273f690c..4936781bf 100644 --- a/UnitTests/Views/SliderTests.cs +++ b/UnitTests/Views/SliderTests.cs @@ -508,8 +508,9 @@ public class SliderTests view.BeginInit (); view.EndInit (); + // BUGBUG: This should not be needed. EndInit should have called LayoutSubviews + // BUGBUG: and LayoutSubviews should have view.LayoutSubviews (); - slider.SetRelativeLayout(view.Viewport.Size); Size expectedSize = slider.Frame.Size;