diff --git a/Source/Engine/UI/GUI/Control.cs b/Source/Engine/UI/GUI/Control.cs index c96ee0643..da15c1f1a 100644 --- a/Source/Engine/UI/GUI/Control.cs +++ b/Source/Engine/UI/GUI/Control.cs @@ -495,6 +495,11 @@ namespace FlaxEngine.GUI /// public bool IsNavFocused => _isNavFocused; + /// + /// Event fired when control gets focus. + /// + public event Action Focused; + /// /// Sets input focus to the control /// @@ -523,18 +528,17 @@ namespace FlaxEngine.GUI [NoAnimate] public virtual void OnGotFocus() { - // Cache flag _isFocused = true; _isNavFocused = false; + Focused?.Invoke(); } /// - /// When control losts input focus + /// When control looses input focus /// [NoAnimate] public virtual void OnLostFocus() { - // Clear flag _isFocused = false; _isNavFocused = false; } @@ -681,7 +685,7 @@ namespace FlaxEngine.GUI /// The navigation start location (in the control-space). /// The control that calls the event. /// The list with visited controls. Used to skip recursive navigation calls when doing traversal across the UI hierarchy. - /// The target navigation control or null if didn't performed any navigation. + /// The target navigation control or null if didn't perform any navigation. public virtual Control OnNavigate(NavDirection direction, Float2 location, Control caller, List visited) { if (caller == _parent && AutoFocus && Visible)