Move the text alignment demo elsewhere, so I can debug other things

This commit is contained in:
miguel
2020-04-13 14:43:46 -04:00
parent 623e67692c
commit 6d08364ad9
2 changed files with 17 additions and 8 deletions

View File

@@ -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),

View File

@@ -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