Beispiel #1
0
 public void HideEditor()
 {
     if (CurrentEditorOwner != null)
     {
         CurrentEditorOwner.EndEdit(false);
     }
 }
 void EditorLeave(object sender, EventArgs e)
 {
     // ilexp, 2016-01-16: Replaced "this.HideEditor(true)" with a detour over the editor's "EndEdit(true)", so the "OnEditorHided()" event is properly called
     if (CurrentEditorOwner != null)
     {
         CurrentEditorOwner.EndEdit(true);
     }
 }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (CurrentEditorOwner != null)
            {
                CurrentEditorOwner.EndEdit(true);
                return;
            }

            if (!Focused)
            {
                Focus();
            }

            _search.EndSearch();
            if (e.Button == MouseButtons.Left)
            {
                TreeColumn c;
                c = GetColumnDividerAt(e.Location);
                if (c != null)
                {
                    Input = new ResizeColumnState(this, c, e.Location);
                    return;
                }
                c = GetColumnAt(e.Location);
                if (c != null)
                {
                    Input = new ClickColumnState(this, c, e.Location);
                    UpdateView();
                    return;
                }
            }

            ChangeInput();
            TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);

            if (args.Node != null && args.Control != null)
            {
                args.Control.MouseDown(args);
            }

            if (!args.Handled)
            {
                Input.MouseDown(args);
            }

            base.OnMouseDown(e);
        }
Beispiel #4
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            _dragEscaped = false;

            if (CurrentEditorOwner != null)
            {
                CurrentEditorOwner.EndEdit(true);
                return;
            }

            if (!Focused && this.GetStyle(ControlStyles.Selectable))
            {
                Focus();
            }

            //_search?.EndSearch();
            if (e.Button == MouseButtons.Left)
            {
                TreeColumn c;
                c = GetColumnDividerAt(e.Location);
                if (c != null)
                {
                    Input = new ResizeColumnState(this, c, e.Location);
                    return;
                }
                c = GetColumnAt(e.Location);
                if (c != null)
                {
                    Input = new ClickColumnState(this, c, e.Location);
                    UpdateView();
                    return;
                }
            }

            ChangeInput();
            TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);

            args.Control?.MouseDown(args);

            if (!args.Handled)
            {
                Input.MouseDown(args);
            }

            base.OnMouseDown(e);
        }
Beispiel #5
0
        private void Editor_LostFocus(object sender, EventArgs e)
        {
            var c = CurrentEditor;

            if (c != null && !ContainsFocus && c.TopLevelControl == Form.ActiveForm)
            {
                //async to avoid a hard-to-debug ObjectDisposedException
                ATimer.After(100, _ =>
                {
                    if (CurrentEditor != null && !ContainsFocus)
                    {
                        CurrentEditorOwner.EndEdit(true);
                        UpdateView();
                    }
                });
            }
        }