From 9438835845dae4eb12e19ff431f6603fe9ad8e16 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Sat, 5 Nov 2022 18:45:36 -0600 Subject: [PATCH] Fixed bug in scenario that was there all along; cleaned up a bit. renamed --- UICatalog/Properties/launchSettings.json | 4 ++ UICatalog/Scenarios/WindowsAndFrameViews.cs | 59 +++++++++++---------- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/UICatalog/Properties/launchSettings.json b/UICatalog/Properties/launchSettings.json index b621c2df5..ecd1a78c7 100644 --- a/UICatalog/Properties/launchSettings.json +++ b/UICatalog/Properties/launchSettings.json @@ -52,6 +52,10 @@ "All Views Tester": { "commandName": "Project", "commandLineArgs": "\"All Views Tester\"" + }, + "Windows & FrameViews": { + "commandName": "Project", + "commandLineArgs": "\"Windows & FrameViews\"" } } } \ No newline at end of file diff --git a/UICatalog/Scenarios/WindowsAndFrameViews.cs b/UICatalog/Scenarios/WindowsAndFrameViews.cs index 616c20fca..4f424901a 100644 --- a/UICatalog/Scenarios/WindowsAndFrameViews.cs +++ b/UICatalog/Scenarios/WindowsAndFrameViews.cs @@ -3,50 +3,34 @@ using System.Linq; using Terminal.Gui; namespace UICatalog.Scenarios { - [ScenarioMetadata (Name: "Windows & FrameViews", Description: "Shows Windows, sub-Windows, and FrameViews.")] + [ScenarioMetadata (Name: "Windows & FrameViews", Description: "Stress Tests Windows, sub-Windows, and FrameViews.")] [ScenarioCategory ("Layout")] public class WindowsAndFrameViews : Scenario { - public override void RequestStop () - { - base.RequestStop (); - } - - public override void Run () - { - base.Run (); - } - + public override void Setup () { static int About () { return MessageBox.Query ("About UI Catalog", "UI Catalog is a comprehensive sample library for Terminal.Gui", "Ok"); - - //var about = new Window (new Rect (0, 0, 50, 10), "About UI catalog", 0) { - // X = Pos.Center (), - // Y = Pos.Center (), - // Width = 50, - // Height = 10, - // LayoutStyle = LayoutStyle.Computed, - // ColorScheme = Colors.Error, - - //}; - - //Application.Run (about); - //return 0; - } int margin = 2; int padding = 1; int contentHeight = 7; + + // list of Windows we create var listWin = new List (); + + // Ignore the Win that UI Catalog created and create a new one + Application.Top.Remove (Win); + Win?.Dispose (); Win = new Window ($"{listWin.Count} - Scenario: {GetName ()}", padding) { X = Pos.Center (), Y = 1, - Width = Dim.Fill (10), - Height = Dim.Percent (15) + Width = Dim.Fill (15), + Height = 10 }; + Win.ColorScheme = Colors.Dialog; var paddingButton = new Button ($"Padding of container is {padding}") { X = Pos.Center (), @@ -61,8 +45,17 @@ namespace UICatalog.Scenarios { ColorScheme = Colors.Error }); Application.Top.Add (Win); + + // add it to our list listWin.Add (Win); + // create 3 more Windows in a loop, adding them Application.Top + // Each with a + // button + // sub Window with + // TextField + // sub FrameView with + // for (var i = 0; i < 3; i++) { Window win = null; win = new Window ($"{listWin.Count} - Window Loop - padding = {i}", i) { @@ -111,6 +104,18 @@ namespace UICatalog.Scenarios { listWin.Add (win); } + // Add a FrameView (frame) to Application.Top + // Position it at Bottom, using the list of Windows we created above. + // Fill it with + // a label + // a SubWindow containing (subWinofFV) + // a TextField + // two checkboxes + // a Sub FrameView containing (subFrameViewofFV) + // a TextField + // two CheckBoxes + // a checkbox + // a checkbox FrameView frame = null; frame = new FrameView ($"This is a FrameView") { X = margin,