Skip to content

Commit 4faecc2

Browse files
author
tznind
committed
Update to latest changes to TableView to have to use Cursor instead of Row
1 parent 43209c8 commit 4faecc2

5 files changed

Lines changed: 19 additions & 18 deletions

File tree

Showcase/Showcase.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Terminal.Gui" Version="2.0.0-develop.5281 " />
12+
<PackageReference Include="Terminal.Gui" Version="2.0.0-develop.5373 " />
1313
</ItemGroup>
1414

1515
</Project>

src/Design.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
using NLog;
12
using System.Data;
23
using System.Diagnostics.CodeAnalysis;
34
using System.Net.Mime;
45
using System.Reflection;
56
using System.Xml.Linq;
6-
using NLog;
77
using Terminal.Gui;
88
using Terminal.Gui.App;
99
using Terminal.Gui.Configuration;
@@ -16,6 +16,7 @@
1616
using TerminalGuiDesigner.Operations.StatusBarOperations;
1717
using TerminalGuiDesigner.Operations.TableViewOperations;
1818
using TerminalGuiDesigner.ToCode;
19+
using static System.Net.Mime.MediaTypeNames;
1920

2021
namespace TerminalGuiDesigner;
2122

@@ -239,22 +240,23 @@ public Design CreateSubControlDesign(string name, View subView)
239240

240241
if (subView is TreeView tree)
241242
{
242-
tree.AddObject(new TreeNode("Example Branch 1")
243-
{
244-
Children = new[] { new TreeNode("Child 1") },
243+
tree.AddObject(new TreeNode() {
244+
Text = "Example Branch 1",
245+
Children = new[] { new TreeNode() { Text = "Child 1" } },
245246
});
246-
tree.AddObject(new TreeNode("Example Branch 2")
247+
tree.AddObject(new TreeNode()
247248
{
249+
Text = "Example Branch 2",
248250
Children = new[]
249251
{
250-
new TreeNode("Child 1"),
251-
new TreeNode("Child 2"),
252+
new TreeNode() { Text = "Child 1" },
253+
new TreeNode() { Text = "Child 2" },
252254
},
253255
});
254256

255257
for (int l = 0; l < 20; l++)
256258
{
257-
tree.AddObject(new TreeNode($"Example Leaf {l}"));
259+
tree.AddObject(new TreeNode() { Text = $"Example Leaf {l}" });
258260
}
259261
}
260262

@@ -312,9 +314,9 @@ public IEnumerable<IOperation> GetExtraOperations(Mouse? mouse = null)
312314
}
313315

314316
// if no column was right clicked then provide commands for the selected column
315-
if (col == null && tv.SelectedColumn >= 0)
317+
if (col == null && tv.Cursor.Position.Value.X >= 0)
316318
{
317-
col = dt.Columns[tv.SelectedColumn];
319+
col = dt.Columns[tv.Cursor.Position.Value.X];
318320
}
319321

320322
yield return new AddColumnOperation(App, this, null);
@@ -756,7 +758,6 @@ private IEnumerable<Property> LoadDesignableProperties()
756758
yield return this.CreateSubProperty(nameof(TreeStyle.ColorExpandSymbol), nameof(TreeView<ITreeNode>.Style), tree.Style);
757759
yield return this.CreateSubProperty(nameof(TreeStyle.ExpandableSymbol), nameof(TreeView<ITreeNode>.Style), tree.Style);
758760
yield return this.CreateSubProperty(nameof(TreeStyle.InvertExpandSymbolColors), nameof(TreeView<ITreeNode>.Style), tree.Style);
759-
yield return this.CreateSubProperty(nameof(TreeStyle.LeaveLastRow), nameof(TreeView<ITreeNode>.Style), tree.Style);
760761
yield return this.CreateSubProperty(nameof(TreeStyle.ShowBranchLines), nameof(TreeView<ITreeNode>.Style), tree.Style);
761762
}
762763

src/TerminalGuiDesigner.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<PackageOutputPath>./nupkg</PackageOutputPath>
2121
<ImplicitUsings>enable</ImplicitUsings>
2222
<PackageId>TerminalGuiDesigner</PackageId>
23-
<Version>2.0.0-develop.5281</Version>
23+
<Version>2.0.0-develop.5373</Version>
2424
<Authors>Thomas Nind</Authors>
2525
<Nullable>enable</Nullable>
2626
<PackageLicenseExpression>MIT</PackageLicenseExpression>
@@ -33,7 +33,7 @@
3333
<PackageIcon>logo.png</PackageIcon>
3434
<PackageReadmeFile>README.md</PackageReadmeFile>
3535
<PackageReleaseNotes>
36-
2.0.0-alpha.5281
36+
2.0.0-alpha.5373
3737
* Update to latest nuget package
3838
* Fix crash caused moving PosRelative view without its pair into different container View
3939
2.0.0-alpha.4519
@@ -165,7 +165,7 @@
165165
<PackageReference Include="Serilog" Version="4.2.0" />
166166
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.0" />
167167
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
168-
<PackageReference Include="Terminal.Gui" Version="2.0.0-develop.5281" />
168+
<PackageReference Include="Terminal.Gui" Version="2.0.0-develop.5373" />
169169
<PackageReference Include="nlog" Version="5.3.3" />
170170
<PackageReference Include="Basic.Reference.Assemblies.Net100" Version="1.7.7" />
171171
<PackageReference Include="System.CodeDom" Version="10.0.0" />

src/UI/Windows/KeyBindingsUI.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public KeyBindingsUI(IApplication app, KeyMap keyMap) {
6060
return null;
6161
};
6262

63-
tableView.CellActivated += (s, e) =>
63+
tableView.Activated += (s, e) =>
6464
{
65-
var prop = _props[e.Row];
65+
var prop = _props[tableView.Cursor.Position.Value.Y];
6666
var k = Modals.GetShortcut(app);
6767
prop.SetValue(this.keyMap,k.ToString());
6868
this.SetNeedsDraw();

src/ViewFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public static T Create<T>(int? width = null, int? height = null, string? text =
278278
{
279279
return Enumerable.Empty<FileSystemInfo>();
280280
}
281-
});
281+
},(f)=>f is DirectoryInfo);
282282

283283
SetDefaultDimensions(newView, width ?? 16, height ?? 5);
284284
break;

0 commit comments

Comments
 (0)