From 6667b33cf57b1f06694c47ad4a64ba8d3795b678 Mon Sep 17 00:00:00 2001 From: Tig Date: Sun, 25 Aug 2024 07:27:43 -0700 Subject: [PATCH] Fixsed colorpicker tab order --- Terminal.Gui/View/View.Navigation.cs | 11 +++++++---- Terminal.Gui/Views/ColorPicker.cs | 9 +++++++-- UICatalog/Scenarios/ViewExperiments.cs | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Terminal.Gui/View/View.Navigation.cs b/Terminal.Gui/View/View.Navigation.cs index d66a74470..c282cebf9 100644 --- a/Terminal.Gui/View/View.Navigation.cs +++ b/Terminal.Gui/View/View.Navigation.cs @@ -33,7 +33,7 @@ public partial class View // Focus and cross-view navigation management (TabStop /// focusable to also gain focus (as long as /// /// - /// Setting this property to will cause to set + /// Setting this property to will cause to set /// the focus on the next view to be focused. /// /// @@ -429,10 +429,13 @@ public partial class View // Focus and cross-view navigation management (TabStop // We're moving beyond the last subview // Determine if focus should remain in this focus chain, or move to the superview's focus chain - if (SuperView is { } && SuperView.GetScopedTabIndexes (direction, behavior).Length > 1) + if (SuperView is { } && SuperView.TabStop != TabBehavior.NoStop && SuperView.GetScopedTabIndexes (direction, behavior).Length > 1) { - // Our superview has an focusable subview in addition to us - return false; + //if (behavior == TabBehavior.TabGroup && behavior == TabStop && SuperView?.TabStop == TabBehavior.TabGroup) + { + // Our superview has an focusable subview in addition to us + return false; + } } // If our superview diff --git a/Terminal.Gui/Views/ColorPicker.cs b/Terminal.Gui/Views/ColorPicker.cs index 3f8ade0ea..c9e5afe35 100644 --- a/Terminal.Gui/Views/ColorPicker.cs +++ b/Terminal.Gui/Views/ColorPicker.cs @@ -52,9 +52,10 @@ public class ColorPicker : View bar.Y = y; bar.Width = Dim.Fill (Style.ShowTextFields ? textFieldWidth : 0); + TextField? tfValue = null; if (Style.ShowTextFields) { - var tfValue = new TextField + tfValue = new TextField { X = Pos.AnchorEnd (textFieldWidth), Y = y, @@ -62,7 +63,6 @@ public class ColorPicker : View }; tfValue.HasFocusChanged += UpdateSingleBarValueFromTextField; _textFields.Add (bar, tfValue); - Add (tfValue); } y++; @@ -72,6 +72,11 @@ public class ColorPicker : View _bars.Add (bar); Add (bar); + + if (tfValue is { }) + { + Add (tfValue); + } } if (Style.ShowColorName) diff --git a/UICatalog/Scenarios/ViewExperiments.cs b/UICatalog/Scenarios/ViewExperiments.cs index 2d10a8544..637475a6a 100644 --- a/UICatalog/Scenarios/ViewExperiments.cs +++ b/UICatalog/Scenarios/ViewExperiments.cs @@ -100,7 +100,7 @@ public class ViewExperiments : Scenario Id = $"Tiled{id}", BorderStyle = LineStyle.Single, CanFocus = true, // Can't drag without this? BUGBUG - TabStop = TabBehavior.TabGroup, + TabStop = TabBehavior.TabStop, Arrangement = ViewArrangement.Fixed };