Merge pull request #865 from BDisp/frameview-tab-fix

Fixes #864. FrameView has only one contentView now.
This commit is contained in:
Charlie Kindel
2020-08-15 08:51:10 -07:00
committed by GitHub
2 changed files with 16 additions and 4 deletions

View File

@@ -182,7 +182,7 @@ namespace Terminal.Gui {
case Key.CursorRight:
case Key.CursorDown:
case Key.ControlI: // Unix
var old = Focused;
var old = GetDeepestFocusedSubview (Focused);
if (!FocusNext ())
FocusNext ();
if (old != Focused) {
@@ -195,7 +195,7 @@ namespace Terminal.Gui {
case Key.CursorLeft:
case Key.CursorUp:
case Key.BackTab:
old = Focused;
old = GetDeepestFocusedSubview (Focused);
if (!FocusPrev ())
FocusPrev ();
if (old != Focused) {
@@ -213,6 +213,16 @@ namespace Terminal.Gui {
return false;
}
View GetDeepestFocusedSubview (View view)
{
foreach (var v in view.Subviews) {
if (v.HasFocus) {
return GetDeepestFocusedSubview (v);
}
}
return view;
}
IEnumerable<View> GetToplevelSubviews (bool isForward)
{
if (SuperView == null) {

View File

@@ -92,8 +92,10 @@ namespace Terminal.Gui {
void Initialize ()
{
base.Add (contentView);
contentView.Text = base.Text;
if (Subviews?.Count == 0) {
base.Add (contentView);
contentView.Text = base.Text;
}
}
void DrawFrame ()