|
| 1 | +using NLog; |
1 | 2 | using System.Data; |
2 | 3 | using System.Diagnostics.CodeAnalysis; |
3 | 4 | using System.Net.Mime; |
4 | 5 | using System.Reflection; |
5 | 6 | using System.Xml.Linq; |
6 | | -using NLog; |
7 | 7 | using Terminal.Gui; |
8 | 8 | using Terminal.Gui.App; |
9 | 9 | using Terminal.Gui.Configuration; |
|
16 | 16 | using TerminalGuiDesigner.Operations.StatusBarOperations; |
17 | 17 | using TerminalGuiDesigner.Operations.TableViewOperations; |
18 | 18 | using TerminalGuiDesigner.ToCode; |
| 19 | +using static System.Net.Mime.MediaTypeNames; |
19 | 20 |
|
20 | 21 | namespace TerminalGuiDesigner; |
21 | 22 |
|
@@ -239,22 +240,23 @@ public Design CreateSubControlDesign(string name, View subView) |
239 | 240 |
|
240 | 241 | if (subView is TreeView tree) |
241 | 242 | { |
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" } }, |
245 | 246 | }); |
246 | | - tree.AddObject(new TreeNode("Example Branch 2") |
| 247 | + tree.AddObject(new TreeNode() |
247 | 248 | { |
| 249 | + Text = "Example Branch 2", |
248 | 250 | Children = new[] |
249 | 251 | { |
250 | | - new TreeNode("Child 1"), |
251 | | - new TreeNode("Child 2"), |
| 252 | + new TreeNode() { Text = "Child 1" }, |
| 253 | + new TreeNode() { Text = "Child 2" }, |
252 | 254 | }, |
253 | 255 | }); |
254 | 256 |
|
255 | 257 | for (int l = 0; l < 20; l++) |
256 | 258 | { |
257 | | - tree.AddObject(new TreeNode($"Example Leaf {l}")); |
| 259 | + tree.AddObject(new TreeNode() { Text = $"Example Leaf {l}" }); |
258 | 260 | } |
259 | 261 | } |
260 | 262 |
|
@@ -312,9 +314,9 @@ public IEnumerable<IOperation> GetExtraOperations(Mouse? mouse = null) |
312 | 314 | } |
313 | 315 |
|
314 | 316 | // 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) |
316 | 318 | { |
317 | | - col = dt.Columns[tv.SelectedColumn]; |
| 319 | + col = dt.Columns[tv.Cursor.Position.Value.X]; |
318 | 320 | } |
319 | 321 |
|
320 | 322 | yield return new AddColumnOperation(App, this, null); |
@@ -756,7 +758,6 @@ private IEnumerable<Property> LoadDesignableProperties() |
756 | 758 | yield return this.CreateSubProperty(nameof(TreeStyle.ColorExpandSymbol), nameof(TreeView<ITreeNode>.Style), tree.Style); |
757 | 759 | yield return this.CreateSubProperty(nameof(TreeStyle.ExpandableSymbol), nameof(TreeView<ITreeNode>.Style), tree.Style); |
758 | 760 | 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); |
760 | 761 | yield return this.CreateSubProperty(nameof(TreeStyle.ShowBranchLines), nameof(TreeView<ITreeNode>.Style), tree.Style); |
761 | 762 | } |
762 | 763 |
|
|
0 commit comments