public void HideEditor() { if (CurrentEditorOwner != null) { CurrentEditorOwner.EndEdit(false); } }
internal bool HideEditor(bool applyChanges) { if (CurrentEditor != null) { if (applyChanges) { if (!ApplyChanges()) { return(false); } } //Check once more if editor was closed in ApplyChanges if (CurrentEditor != null) { CurrentEditor.Validating -= EditorValidating; CurrentEditorOwner.DoDisposeEditor(CurrentEditor); CurrentEditor.Parent = null; CurrentEditor.Dispose(); CurrentEditor = null; CurrentEditorOwner = null; _editingNode = null; } } return(true); }
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); } }
private bool ApplyChanges() { try { CurrentEditorOwner.ApplyChanges(_editingNode, CurrentEditor); _errorProvider?.Clear(); return(true); } catch (ArgumentException ex) { if (_errorProvider == null) { _errorProvider = new ErrorProvider(); } _errorProvider.SetError(CurrentEditor, ex.Message); return(false); } }
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); }
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); }
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(); } }); } }
private bool ApplyChanges() { try { CurrentEditorOwner.ApplyChanges(_editingNode, CurrentEditor); _errorProvider.Clear(); return(true); } catch (ArgumentException ex) { _errorProvider.SetError(CurrentEditor, ex.Message); /*CurrentEditor.Validating -= EditorValidating; * MessageBox.Show(this, ex.Message, "Value is not valid", MessageBoxButtons.OK, MessageBoxIcon.Warning); * CurrentEditor.Focus(); * CurrentEditor.Validating += EditorValidating;*/ return(false); } }