/// <summary> /// Raises the CancelEdit event /// </summary> /// <param name="e">A CellEditEventArgs that contains the event data</param> protected virtual void OnCancelEdit(CellEditEventArgs e) { if (this.CancelEdit != null) { this.CancelEdit(this, e); } }
/// <summary> /// Raises the BeginEdit event /// </summary> /// <param name="e">A CellEditEventArgs that contains the event data</param> protected virtual void OnBeginEdit(CellEditEventArgs e) { if (this.BeginEdit != null) { this.BeginEdit(this, e); } }
/// <summary> /// Stops editing the Cell and commits any changes /// </summary> public virtual void StopEditing() { Application.RemoveMessageFilter(this.keyMessageFilter); Application.RemoveMessageFilter(this.mouseMessageFilter); // CellEditEventArgs e = new CellEditEventArgs(this.cell, this, this.table, this.cellPos.Row, this.cellPos.Column, this.cellRect); this.table.OnEditingStopped(e); this.OnEndEdit(e); if (!e.Cancel && !e.Handled) { this.SetCellValue(); } this.RemoveEditControl(); }
/// <summary> /// Stops editing the Cell and ignores any changes /// </summary> public virtual void CancelEditing() { Application.RemoveMessageFilter(this.keyMessageFilter); Application.RemoveMessageFilter(this.mouseMessageFilter); // CellEditEventArgs e = new CellEditEventArgs(this.cell, this, this.table, this.cellPos.Row, this.cellPos.Column, this.cellRect); this.table.OnEditingCancelled(e); this.OnCancelEdit(e); this.RemoveEditControl(); }
/// <summary> /// Prepares the CellEditor to edit the specified Cell /// </summary> /// <param name="cell">The Cell to be edited</param> /// <param name="table">The Table that contains the Cell</param> /// <param name="cellPos">A CellPos representing the position of the Cell</param> /// <param name="cellRect">The Rectangle that represents the Cells location and size</param> /// <param name="userSetEditorValues">Specifies whether the ICellEditors /// starting value has already been set by the user</param> /// <returns>true if the ICellEditor can continue editing the Cell, false otherwise</returns> public virtual bool PrepareForEditing(Cell cell, Table table, CellPos cellPos, Rectangle cellRect, bool userSetEditorValues) { // this.cell = cell; this.table = table; this.cellPos = cellPos; this.cellRect = cellRect; // check if the user has already set the editors value for us if (!userSetEditorValues) { this.SetEditValue(); } this.SetEditLocation(cellRect); // raise the BeginEdit event CellEditEventArgs e = new CellEditEventArgs(cell, this, table, cellPos.Row, cellPos.Column, cellRect); e.Handled = userSetEditorValues; this.OnBeginEdit(e); // if the edit has been canceled, remove the editor and return false if (e.Cancel) { this.RemoveEditControl(); return false; } return true; }