Return focus to the previous control when closing a context menu
Fixes the fancy Visject input stuff
This commit is contained in:
@@ -45,6 +45,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
|||||||
private bool _isSubMenu;
|
private bool _isSubMenu;
|
||||||
private ContextMenuBase _childCM;
|
private ContextMenuBase _childCM;
|
||||||
private Window _window;
|
private Window _window;
|
||||||
|
private Control _previouslyFocused;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if context menu is opened
|
/// Returns true if context menu is opened
|
||||||
@@ -185,6 +186,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
|||||||
return;
|
return;
|
||||||
_window.Show();
|
_window.Show();
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
|
_previouslyFocused = parentWin.FocusedControl;
|
||||||
Focus();
|
Focus();
|
||||||
OnShow();
|
OnShow();
|
||||||
}
|
}
|
||||||
@@ -221,6 +223,10 @@ namespace FlaxEditor.GUI.ContextMenu
|
|||||||
_parentCM = null;
|
_parentCM = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return focus
|
||||||
|
_previouslyFocused?.RootWindow?.Focus();
|
||||||
|
_previouslyFocused?.Focus();
|
||||||
|
|
||||||
// Hide
|
// Hide
|
||||||
Visible = false;
|
Visible = false;
|
||||||
OnHide();
|
OnHide();
|
||||||
|
|||||||
Reference in New Issue
Block a user