Ensures the HasFocus property only can be set by the SetHasFocus method. Removed unnecessary code in Menu.

This commit is contained in:
BDisp
2020-07-04 09:43:18 +01:00
parent 89afea2e7d
commit f9d55c9d08
3 changed files with 2 additions and 4 deletions

View File

@@ -24,12 +24,11 @@ namespace Terminal.Gui {
/// <value><c>true</c> if can focus; otherwise, <c>false</c>.</value>
public virtual bool CanFocus { get; set; }
internal bool hasFocus;
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Responder"/> has focus.
/// </summary>
/// <value><c>true</c> if has focus; otherwise, <c>false</c>.</value>
public virtual bool HasFocus { get { return hasFocus; } }
public virtual bool HasFocus { get; }
// Key handling
/// <summary>

View File

@@ -895,6 +895,7 @@ namespace Terminal.Gui {
}
}
bool hasFocus;
/// <inheritdoc/>
public override bool HasFocus {
get {

View File

@@ -535,8 +535,6 @@ namespace Terminal.Gui {
if (item == null || !item.IsEnabled ()) disabled = true;
if (item != null && !disabled)
current = me.Y - 1;
hasFocus = true;
SetNeedsDisplay ();
CheckSubMenu ();
return true;
}