Fix textbox defocus on edit end

#789
This commit is contained in:
Wojtek Figat
2022-11-24 21:54:54 +01:00
parent 18c4e34af8
commit e713273942

View File

@@ -370,7 +370,7 @@ namespace FlaxEngine.GUI
{
Focus();
SetText(value);
Defocus();
RemoveFocus();
}
/// <summary>
@@ -907,6 +907,14 @@ namespace FlaxEngine.GUI
return HitTestText(location);
}
private void RemoveFocus()
{
if (Parent != null)
Parent.Focus();
else
Defocus();
}
/// <summary>
/// Calculates total text size. Called by <see cref="OnTextChanged"/> to cache the text size.
/// </summary>
@@ -1297,7 +1305,7 @@ namespace FlaxEngine.GUI
_text = _onStartEditValue;
if (!IsNavFocused)
Defocus();
RemoveFocus();
OnTextChanged();
return true;
@@ -1311,7 +1319,7 @@ namespace FlaxEngine.GUI
else if (!IsNavFocused)
{
// End editing
Defocus();
RemoveFocus();
}
return true;
case KeyboardKeys.Home: