Fixsed colorpicker tab order

This commit is contained in:
Tig
2024-08-25 07:27:43 -07:00
parent bdc60c9490
commit 6667b33cf5
3 changed files with 15 additions and 7 deletions

View File

@@ -33,7 +33,7 @@ public partial class View // Focus and cross-view navigation management (TabStop
/// focusable to also gain focus (as long as <see cref="TabStop"/>
/// </para>
/// <para>
/// Setting this property to <see langword="false"/> will cause <see cref="ApplicationNavigation.MoveNextView"/> to set
/// Setting this property to <see langword="false"/> will cause <see cref="AdvanceFocus"/> to set
/// the focus on the next view to be focused.
/// </para>
/// </remarks>
@@ -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

View File

@@ -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)

View File

@@ -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
};