diff --git a/Terminal.Gui/Core/Frame.cs b/Terminal.Gui/Core/Frame.cs index 0417f67e03..900134d92a 100644 --- a/Terminal.Gui/Core/Frame.cs +++ b/Terminal.Gui/Core/Frame.cs @@ -16,7 +16,7 @@ namespace Terminal.Gui { /// enabling borders, menus, etc... /// public class Frame : View { - private Thickness _thickness; + private Thickness _thickness = Thickness.Empty; internal override void CreateFrames () { /* Do nothing - Frames do not have Frames */ } diff --git a/Terminal.Gui/Core/Window.cs b/Terminal.Gui/Core/Window.cs index 2853496aef..98ceb560c9 100644 --- a/Terminal.Gui/Core/Window.cs +++ b/Terminal.Gui/Core/Window.cs @@ -121,6 +121,12 @@ void SetInitialProperties (ustring title, Rect frame, int padding = 0, Border bo // TODO: Hack until Border is refactored Padding.Thickness = Border.PaddingThickness ?? Padding.Thickness; + + if (frame.IsEmpty) { + // Make it bigger to fit the margin, border, & padding + frame = new Rect (frame.Location, new Size (Margin.Thickness.Horizontal + BorderFrame.Thickness.Horizontal + Padding.Thickness.Horizontal + 1, Margin.Thickness.Vertical + BorderFrame.Thickness.Vertical + Padding.Thickness.Vertical + 1)); + } + Frame = frame; } public override void BeginInit () diff --git a/Terminal.Gui/Views/Label.cs b/Terminal.Gui/Views/Label.cs index fa1a4ee938..e1048e2387 100644 --- a/Terminal.Gui/Views/Label.cs +++ b/Terminal.Gui/Views/Label.cs @@ -56,6 +56,7 @@ public Label (ustring text, TextDirection direction, bool autosize = true) void SetInitialProperties (bool autosize = true) { + Height = 1; AutoSize = autosize; } diff --git a/UICatalog/Scenarios/ASCIICustomButton.cs b/UICatalog/Scenarios/ASCIICustomButton.cs index 1c943e91dc..4d856e74c1 100644 --- a/UICatalog/Scenarios/ASCIICustomButton.cs +++ b/UICatalog/Scenarios/ASCIICustomButton.cs @@ -99,7 +99,8 @@ private void CustomInitialize (string id, string text, Pos x, Pos y, int width, }; border.MouseClick += This_MouseClick; - border.Subviews [0].MouseClick += This_MouseClick; + // BUGBUG: v2 This uses internal knowledge of FrameView an breaks in v2 where FrameView does not have a ContentView + //border.Subviews [0].MouseClick += This_MouseClick; fill.MouseClick += This_MouseClick; title.MouseClick += This_MouseClick; diff --git a/UICatalog/Scenarios/VkeyPacketSimulator.cs b/UICatalog/Scenarios/VkeyPacketSimulator.cs index 4e9667282c..2b542a2094 100644 --- a/UICatalog/Scenarios/VkeyPacketSimulator.cs +++ b/UICatalog/Scenarios/VkeyPacketSimulator.cs @@ -221,14 +221,18 @@ public override void Setup () tvInput.SetFocus (); - Win.LayoutComplete += (_) => { + void Win_LayoutComplete (View.LayoutEventArgs obj) + { inputHorizontalRuler.Text = outputHorizontalRuler.Text = ruler.Repeat ((int)Math.Ceiling ((double)(inputHorizontalRuler.Bounds.Width) / (double)ruler.Length)) [0..(inputHorizontalRuler.Bounds.Width)]; inputVerticalRuler.Height = tvInput.Frame.Height + 1; inputVerticalRuler.Text = ruler.Repeat ((int)Math.Ceiling ((double)(inputVerticalRuler.Bounds.Height) / (double)ruler.Length)) [0..(inputVerticalRuler.Bounds.Height)]; outputVerticalRuler.Text = ruler.Repeat ((int)Math.Ceiling ((double)(outputVerticalRuler.Bounds.Height) / (double)ruler.Length)) [0..(outputVerticalRuler.Bounds.Height)]; - }; + } + + Win.LayoutComplete += Win_LayoutComplete; } + private void AddKeyboardStrokes (View.KeyEventEventArgs e) { var ke = e.KeyEvent;