Skip to content

Commit afa0246

Browse files
author
tznind
committed
Add new showcases, identify issue with DelegateTreeBuilder code
1 parent 527983a commit afa0246

4 files changed

Lines changed: 210 additions & 2 deletions

File tree

Showcase/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ static void Main(string[] args)
1212
Type[] types = [
1313
typeof(Menus),
1414
typeof(Buttons),
15+
typeof(Text),
1516
typeof(Checkboxes),
1617
typeof(DateTimes),
1718
typeof(ColorPickers),

Showcase/Text.Designer.cs

Lines changed: 183 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Showcase/Text.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,32 @@
99
// -----------------------------------------------------------------------------
1010
namespace Showcase {
1111
using Terminal.Gui;
12-
13-
12+
using Terminal.Gui.Views;
13+
1414
public partial class Text {
1515

1616
public Text() {
1717
InitializeComponent();
18+
19+
try
20+
{
21+
var dirs = Environment.GetLogicalDrives().Select(p => new DirectoryInfo(p));
22+
treeView1.AddObjects(dirs);
23+
}
24+
catch (Exception)
25+
{
26+
// Could not enumerate drives on system, maybe permission issue
27+
}
28+
29+
30+
treeView.AddObject(new TreeNode()
31+
{
32+
Text = "Root",
33+
Children = [
34+
new TreeNode(){ Text="Child 1"},
35+
new TreeNode(){ Text="Child 2"},
36+
]
37+
});
1838
}
1939
}
2040
}

src/ViewFactory.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ public static class ViewFactory
9393
typeof(StatusBar),
9494
typeof(Tabs),
9595
typeof(TitleView),
96+
97+
// Only point of this view is to have a regex validation on view but we don't have designer yet for regex type
98+
typeof(TextValidateField)
9699
];
97100

98101
/// <summary>
@@ -184,6 +187,7 @@ public static T Create<T>(int? width = null, int? height = null, string? text =
184187
case Button:
185188
case CheckBox:
186189
case Label:
190+
case Link:
187191
newView.SetActualText(text ?? "Heya");
188192
SetDefaultDimensionsDimAuto(newView);
189193
break;

0 commit comments

Comments
 (0)