浏览代码

Fixing some bugs.

BDisp 5 年之前
父节点
当前提交
7a32bcf6af
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      Terminal.Gui/Core/View.cs

+ 5 - 4
Terminal.Gui/Core/View.cs

@@ -917,8 +917,8 @@ namespace Terminal.Gui {
 
 
 			// Remove focus down the chain of subviews if focus is removed
 			// Remove focus down the chain of subviews if focus is removed
 			if (!value && focused != null) {
 			if (!value && focused != null) {
-				focused.OnLeave (focused);
-				focused.hasFocus = false;
+				focused.OnLeave (view);
+				focused.SetHasFocus (false, view);
 				focused = null;
 				focused = null;
 			}
 			}
 		}
 		}
@@ -1135,8 +1135,9 @@ namespace Terminal.Gui {
 			if (focused != null)
 			if (focused != null)
 				focused.SetHasFocus (false, view);
 				focused.SetHasFocus (false, view);
 
 
+			var f = focused;
 			focused = view;
 			focused = view;
-			focused.SetHasFocus (true, view);
+			focused.SetHasFocus (true, f);
 			focused.EnsureFocus ();
 			focused.EnsureFocus ();
 
 
 			// Send focus upwards
 			// Send focus upwards
@@ -1340,7 +1341,7 @@ namespace Terminal.Gui {
 				}
 				}
 			}
 			}
 			if (focused != null) {
 			if (focused != null) {
-				focused.SetHasFocus (false, focused);
+				focused.SetHasFocus (false, this);
 				focused = null;
 				focused = null;
 			}
 			}
 			return false;
 			return false;