Browse Source

Fixing some bugs.

BDisp 5 years ago
parent
commit
7a32bcf6af
1 changed files with 5 additions and 4 deletions
  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
 			if (!value && focused != null) {
-				focused.OnLeave (focused);
-				focused.hasFocus = false;
+				focused.OnLeave (view);
+				focused.SetHasFocus (false, view);
 				focused = null;
 			}
 		}
@@ -1135,8 +1135,9 @@ namespace Terminal.Gui {
 			if (focused != null)
 				focused.SetHasFocus (false, view);
 
+			var f = focused;
 			focused = view;
-			focused.SetHasFocus (true, view);
+			focused.SetHasFocus (true, f);
 			focused.EnsureFocus ();
 
 			// Send focus upwards
@@ -1340,7 +1341,7 @@ namespace Terminal.Gui {
 				}
 			}
 			if (focused != null) {
-				focused.SetHasFocus (false, focused);
+				focused.SetHasFocus (false, this);
 				focused = null;
 			}
 			return false;