diff --git a/Terminal.Gui/View/View.cs b/Terminal.Gui/View/View.cs index f4e9c2d0d..1632eca2f 100644 --- a/Terminal.Gui/View/View.cs +++ b/Terminal.Gui/View/View.cs @@ -252,7 +252,6 @@ public partial class View : Responder, ISupportInitializeNotification } Initialized?.Invoke (this, EventArgs.Empty); - LayoutSubviews(); } #endregion Constructors and Initialization diff --git a/UICatalog/Scenarios/Adornments.cs b/UICatalog/Scenarios/Adornments.cs index af0e3fd60..cde56a8c7 100644 --- a/UICatalog/Scenarios/Adornments.cs +++ b/UICatalog/Scenarios/Adornments.cs @@ -18,15 +18,21 @@ public class Adornments : Scenario var editor = new AdornmentsEditor { - AutoSelectViewToEdit = true + AutoSelectViewToEdit = true, + // This is for giggles, to show that the editor can be moved around. + Arrangement = ViewArrangement.Movable, + X = Pos.AnchorEnd() + }; + editor.Border.Thickness = new Thickness (1, 3, 1, 1); + app.Add (editor); var window = new Window { Title = "The _Window", Arrangement = ViewArrangement.Movable, - X = Pos.Right (editor), + // X = Pos.Center (), Width = Dim.Percent (60), Height = Dim.Percent (80) }; @@ -98,7 +104,7 @@ public class Adornments : Scenario window.Padding.Add (labelInPadding); var textFieldInPadding = new TextField - { X = Pos.Right (labelInPadding) + 1, Y = Pos.Top (labelInPadding), Width = 15, Text = "some text" }; + { X = Pos.Right (labelInPadding) + 1, Y = Pos.Top (labelInPadding), Width = 15, Text = "some text" }; textFieldInPadding.Accept += (s, e) => MessageBox.Query (20, 7, "TextField", textFieldInPadding.Text, "Ok"); window.Padding.Add (textFieldInPadding); diff --git a/UICatalog/Scenarios/AdornmentsEditor.cs b/UICatalog/Scenarios/AdornmentsEditor.cs index 020835420..a1e40542b 100644 --- a/UICatalog/Scenarios/AdornmentsEditor.cs +++ b/UICatalog/Scenarios/AdornmentsEditor.cs @@ -24,13 +24,12 @@ public class AdornmentsEditor : View public AdornmentsEditor () { - ColorScheme = Colors.ColorSchemes ["Dialog"]; + //ColorScheme = Colors.ColorSchemes ["Dialog"]; Title = $"AdornmentsEditor"; Width = Dim.Auto (DimAutoStyle.Content); Height = Dim.Auto (DimAutoStyle.Content); - BorderStyle = LineStyle.Double; //SuperViewRendersLineCanvas = true; Application.MouseEvent += Application_MouseEvent; @@ -45,6 +44,8 @@ public class AdornmentsEditor : View private void AdornmentsEditor_Initialized (object sender, EventArgs e) { + BorderStyle = LineStyle.Dotted; + ExpanderButton expandButton = new ExpanderButton () { Orientation = Orientation.Horizontal @@ -124,6 +125,9 @@ public class AdornmentsEditor : View Add (_diagRulerCheckBox); _diagRulerCheckBox.Y = Pos.Bottom (_diagPaddingCheckBox); + // BUGBUG: This should not be needed. There's some bug in the layout system that doesn't update the layout. + SuperView.LayoutSubviews(); + } private void Application_MouseEvent (object sender, MouseEvent e) diff --git a/UICatalog/Scenarios/ExpanderButton.cs b/UICatalog/Scenarios/ExpanderButton.cs index b1a1c3211..cebf9a8d4 100644 --- a/UICatalog/Scenarios/ExpanderButton.cs +++ b/UICatalog/Scenarios/ExpanderButton.cs @@ -15,7 +15,8 @@ namespace UICatalog.Scenarios; /// /// If is set to , the button will appear /// at the top/right. -/// If is set to , the button will appear at the +/// If is set to , the button will +/// appear at the /// bottom/left. /// /// @@ -118,7 +119,7 @@ public class ExpanderButton : Button /// public Rune ExpandedGlyph { get; set; } - private bool _collapsed = false; + private bool _collapsed; /// /// Gets or sets a value indicating whether the view is collapsed. @@ -144,7 +145,6 @@ public class ExpanderButton : Button ExpandOrCollapse (_collapsed); View superView = SuperView; - if (superView is Adornment adornment) { superView = adornment.Parent; @@ -160,7 +160,6 @@ public class ExpanderButton : Button superView.SuperView?.LayoutSubviews (); } - return args.Cancel; } @@ -169,7 +168,7 @@ public class ExpanderButton : Button /// to true. /// public event EventHandler> CollapsedChanging; - + /// /// Collapses or Expands the view. /// @@ -186,7 +185,6 @@ public class ExpanderButton : Button private void ExpandOrCollapse (bool collapse) { View superView = SuperView; - if (superView is Adornment adornment) { superView = adornment.Parent;