mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Merge pull request #2190 from tig/fixes_2188_win_frameview_scenario
Fixes #2188. Latent bug in `Windows & FrameViews` scenario
This commit is contained in:
@@ -52,6 +52,10 @@
|
||||
"All Views Tester": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "\"All Views Tester\""
|
||||
},
|
||||
"Windows & FrameViews": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "\"Windows & FrameViews\""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<View> ();
|
||||
|
||||
//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,
|
||||
|
||||
Reference in New Issue
Block a user