Ejemplo n.º 1
0
        private void OnWindowLostFocus()
        {
            // Skip for parent menus (child should handle lost of focus)
            if (_childCM != null)
            {
                return;
            }

            // Check if user stopped using that popup menu
            var root = TopmostCM;

            if (_parentCM != null)
            {
                // Skip if user clicked over the parent popup
                var mouse = _parentCM.ScreenToClient(Platform.MousePosition / Platform.Dpi);
                if (!_parentCM.ContainsPoint(ref mouse))
                {
                    root.Hide();
                }
                else
                {
                    root._window.Focus();
                    Hide();
                }
            }
            else if (!HasChildCMOpened)
            {
                Hide();
            }
        }
Ejemplo n.º 2
0
        private void OnWindowLostFocus()
        {
            // Skip for parent menus (child should handle lost of focus)
            if (_childCM != null)
            {
                return;
            }

            // Check if user stopped using that popup menu
            if (_parentCM != null)
            {
                // Focus parent if user clicked over the parent popup
                var mouse = _parentCM.ScreenToClient(FlaxEngine.Input.MouseScreenPosition / Platform.DpiScale);
                if (_parentCM.ContainsPoint(ref mouse))
                {
                    _parentCM._window.Focus();
                }
            }
        }