diff --git a/Example/demo.cs b/Example/demo.cs index 6bc7deee0..94b00e9d9 100644 --- a/Example/demo.cs +++ b/Example/demo.cs @@ -82,17 +82,24 @@ static class Demo { } - static void ShowTextAlignments (View container) + static void ShowTextAlignments () { + var container = new Dialog ( + "Text Alignments", 50, 20, + new Button ("Ok", is_default: true) { Clicked = () => { Application.RequestStop (); } }, + new Button ("Cancel") { Clicked = () => { Application.RequestStop (); } }); + + int i = 0; string txt = "Hello world, how are you doing today"; container.Add ( - new FrameView (new Rect (75, 3, txt.Length + 6, 20), "Text Alignments") { new Label(new Rect(0, 1, 40, 3), $"{i+1}-{txt}") { TextAlignment = TextAlignment.Left }, - new Label(new Rect(0, 5, 40, 3), $"{i+2}-{txt}") { TextAlignment = TextAlignment.Right }, - new Label(new Rect(0, 9, 40, 3), $"{i+3}-{txt}") { TextAlignment = TextAlignment.Centered }, - new Label(new Rect(0, 13, 40, 3), $"{i+4}-{txt}") { TextAlignment = TextAlignment.Justified } - }); + new Label(new Rect(0, 3, 40, 3), $"{i+2}-{txt}") { TextAlignment = TextAlignment.Right }, + new Label(new Rect(0, 5, 40, 3), $"{i+3}-{txt}") { TextAlignment = TextAlignment.Centered }, + new Label(new Rect(0, 7, 40, 3), $"{i+4}-{txt}") { TextAlignment = TextAlignment.Justified } + ); + + Application.Run (container); } static void ShowEntries (View container) @@ -463,6 +470,9 @@ static class Demo { new MenuItem ("Select Multiple Items", "", () => ListSelectionDemo (true)), new MenuItem ("Select Single Item", "", () => ListSelectionDemo (false)), }), + new MenuBarItem ("Assorted", new MenuItem [] { + new MenuItem ("Show text alignments", "", () => ShowTextAlignments ()) + }), new MenuBarItem ("Test Menu and SubMenus", new MenuItem [] { new MenuItem ("SubMenu1Item1", new MenuBarItem (new MenuItem[] { @@ -496,8 +506,6 @@ static class Demo { win.Add (test); win.Add (ml); - ShowTextAlignments (win); - var drag = new Label ("Drag: ") { X = 70, Y = 24 }; var dragText = new TextField ("") { X = Pos.Right (drag), diff --git a/Terminal.Gui/Core.cs b/Terminal.Gui/Core.cs index e96b495c2..d0477ef86 100644 --- a/Terminal.Gui/Core.cs +++ b/Terminal.Gui/Core.cs @@ -1188,6 +1188,7 @@ namespace Terminal.Gui { h = height.Anchor (hostFrame.Height - _y); } Frame = new Rect (_x, _y, w, h); + // layoutNeeded = false; } // https://en.wikipedia.org/wiki/Topological_sorting