From 8b5639e5e5689f18aaee4dd4e87253ebb128254c Mon Sep 17 00:00:00 2001 From: BDisp Date: Tue, 18 Mar 2025 10:24:51 +0000 Subject: [PATCH] Using SubViews and letting the top-level handle the key if the TabView doesn't handle it --- Terminal.Gui/Views/TabView/TabView.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Terminal.Gui/Views/TabView/TabView.cs b/Terminal.Gui/Views/TabView/TabView.cs index c127c7aed..98ce20b21 100644 --- a/Terminal.Gui/Views/TabView/TabView.cs +++ b/Terminal.Gui/Views/TabView/TabView.cs @@ -105,15 +105,14 @@ public class TabView : View if (mostFocused is { }) { - for (int? i = mostFocused.SuperView?.InternalSubViews.IndexOf (mostFocused) - 1; i > -1; i--) + for (int? i = mostFocused.SuperView?.SubViews.IndexOf (mostFocused) - 1; i > -1; i--) { - var view = mostFocused.SuperView?.InternalSubViews [(int)i]; + var view = mostFocused.SuperView?.SubViews.ElementAt ((int)i); if (view is { CanFocus: true, Enabled: true, Visible: true }) { - view.SetFocus (); - - return true; + // Let toplevel handle it + return false; } } } @@ -140,15 +139,14 @@ public class TabView : View if (mostFocused is { }) { - for (int? i = mostFocused.SuperView?.InternalSubViews.IndexOf (mostFocused) + 1; i < mostFocused.SuperView?.InternalSubViews.Count; i++) + for (int? i = mostFocused.SuperView?.SubViews.IndexOf (mostFocused) + 1; i < mostFocused.SuperView?.SubViews.Count; i++) { - var view = mostFocused.SuperView?.InternalSubViews [(int)i]; + var view = mostFocused.SuperView?.SubViews.ElementAt ((int)i); if (view is { CanFocus: true, Enabled: true, Visible: true }) { - view.SetFocus (); - - return true; + // Let toplevel handle it + return false; } } }