From 8fbbba750b461f015f0e5b361411cee9b46ed216 Mon Sep 17 00:00:00 2001 From: Tig Date: Sun, 29 Sep 2024 16:58:42 -0600 Subject: [PATCH] ListView --- Terminal.Gui/Views/ListView.cs | 4 +++- UICatalog/Scenarios/Sliders.cs | 8 ++++---- docfx/docs/navigation.md | 27 ++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs index c887879b9..04fd6ac12 100644 --- a/Terminal.Gui/Views/ListView.cs +++ b/Terminal.Gui/Views/ListView.cs @@ -471,7 +471,7 @@ public class ListView : View, IDesignable if (me.Flags == MouseFlags.Button1DoubleClicked) { - OnOpenSelectedItem (); + return OnOpenSelectedItem (); } return true; @@ -766,6 +766,8 @@ public class ListView : View, IDesignable } OpenSelectedItem?.Invoke (this, new ListViewItemEventArgs (_selected, value)); + + // BUGBUG: this should not blindly return true. return true; } diff --git a/UICatalog/Scenarios/Sliders.cs b/UICatalog/Scenarios/Sliders.cs index 71e6957ac..dfab8aa12 100644 --- a/UICatalog/Scenarios/Sliders.cs +++ b/UICatalog/Scenarios/Sliders.cs @@ -78,7 +78,7 @@ public class Sliders : Scenario var single = new Slider (singleOptions) { - Title = "Continuous", + Title = "_Continuous", X = 0, Y = prev == null ? 0 : Pos.Bottom (prev), Type = SliderType.Single, @@ -106,14 +106,14 @@ public class Sliders : Scenario single.OptionsChanged += (s, e) => { - single.Title = $"Continuous {e.Options.FirstOrDefault ().Key}"; + single.Title = $"_Continuous {e.Options.FirstOrDefault ().Key}"; }; List oneOption = new () { "The Only Option" }; var one = new Slider (oneOption) { - Title = "One Option", + Title = "_One Option", X = 0, Y = prev == null ? 0 : Pos.Bottom (single), Type = SliderType.Single, @@ -151,7 +151,7 @@ public class Sliders : Scenario var configView = new FrameView { - Title = "Configuration", + Title = "Confi_guration", X = Pos.Percent (50), Y = 0, Width = Dim.Fill (), diff --git a/docfx/docs/navigation.md b/docfx/docs/navigation.md index 6b774439e..7b211b300 100644 --- a/docfx/docs/navigation.md +++ b/docfx/docs/navigation.md @@ -634,4 +634,29 @@ In v2_develop it's all kinds of confused. Here's what it SHOULD do: Like `Checkbox` the right thing to do is for Hotkey to NOT set focus. Why? If the user is in a TextField and wants to change a setting via a RadioGroup, they should be able to use the hotkey and NOT have to then re-focus back on the TextView. The `TextView` in `Text Input Controls` Scenario is a good example of this. -## `Slider` - Should operate just like RadioGroup \ No newline at end of file +## `Slider` - Should operate just like RadioGroup + +- BUGBUG: Slider should support Hotkey w/in Legends + +## `NumericUpDown` + +## `ListView` + +### `!HasFocus` + +* `Enter` - n/a because no focus +* `Space` - n/a because no focus +* `Title.Hotkey` - `Command.Hotkey` -> Set focus. Do NOT advance state. +* `Click` - `Command.Select` -> If `CanFocus`, sets focus and advances state to clicked ListItem. +* `Double Click` - Sets focus and advances state to clicked ListItem and then raises `Accept`. + +### `HasFocus` + +* `Enter` - `Command.Accept` -> Advances state to selected RadioItem and Raises `Accept` +* `Space` - `Command.Select` -> Advances state +* `Title.Hotkey` - `Command.Hotkey` -> does nothing +* `RadioItem.Hotkey` - `Command.Select` -> Advance State to RadioItem with hotkey. +* `Click` - `Command.Select` -> If `CanFocus`, sets focus and advances state to clicked ListItem. +* `Double Click` - Sets focus and advances state to clicked ListItem and then raises `Accept`. + +What about `ListView.MultiSelect` and `ListViews.AllowsMarking`? \ No newline at end of file