/// <summary> /// Raises the KeyUp event /// </summary> /// <param name="e">A CellKeyEventArgs that contains the event data</param> public override void OnKeyUp(CellKeyEventArgs e) { base.OnKeyUp(e); if (e.KeyData == Keys.Space && e.Table.IsCellEditable(e.CellPos)) { // get the renderer data CheckBoxRendererData rendererData = this.GetCheckBoxRendererData(e.Cell); // if (e.Cell.CheckState == CheckState.Checked) { if (!e.Cell.ThreeState || !(e.Table.ColumnModel.Columns[e.Column] is CheckBoxColumn) || ((CheckBoxColumn) e.Table.ColumnModel.Columns[e.Column]).CheckStyle == CheckBoxColumnStyle.RadioButton) { rendererData.CheckState = CheckBoxStates.UncheckedNormal; e.Cell.CheckState = CheckState.Unchecked; } else { rendererData.CheckState = CheckBoxStates.MixedNormal; e.Cell.CheckState = CheckState.Indeterminate; } } else if (e.Cell.CheckState == CheckState.Indeterminate) { rendererData.CheckState = CheckBoxStates.UncheckedNormal; e.Cell.CheckState = CheckState.Unchecked; } else //if (e.Cell.CheckState == CheckState.Unchecked) { rendererData.CheckState = CheckBoxStates.CheckedNormal; e.Cell.CheckState = CheckState.Checked; } e.Table.Invalidate(e.CellRect); } }
/// <summary> /// Raises the KeyUp event /// </summary> /// <param name="e">A CellKeyEventArgs that contains the event data</param> public override void OnKeyUp(CellKeyEventArgs e) { base.OnKeyUp(e); // get the button renderer data ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell); // if (e.KeyData == Keys.Enter || e.KeyData == Keys.Space) { rendererData.ButtonState = PushButtonStates.Normal; e.Table.Invalidate(e.CellRect); e.Table.OnCellButtonClicked(new CellButtonEventArgs(e.Cell, e.Column, e.Row)); } }
/// <summary> /// Raises the KeyDown event /// </summary> /// <param name="e">A CellKeyEventArgs that contains the event data</param> public override void OnKeyDown(CellKeyEventArgs e) { base.OnKeyDown(e); if (e.KeyData == Keys.Space && e.Table.IsCellEditable(e.CellPos)) { // get the renderer data CheckBoxRendererData rendererData = this.GetCheckBoxRendererData(e.Cell); // if (e.Cell.CheckState == CheckState.Checked) { rendererData.CheckState = CheckBoxStates.CheckedPressed; } else if (e.Cell.CheckState == CheckState.Indeterminate) { rendererData.CheckState = CheckBoxStates.MixedPressed; } else //if (e.Cell.CheckState == CheckState.Unchecked) { rendererData.CheckState = CheckBoxStates.UncheckedPressed; } e.Table.Invalidate(e.CellRect); } }
/// <summary> /// Raises the KeyDown event /// </summary> /// <param name="e">A CellKeyEventArgs that contains the event data</param> public override void OnKeyDown(CellKeyEventArgs e) { base.OnKeyDown(e); // get the button renderer data ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell); // if (e.KeyData == Keys.Enter || e.KeyData == Keys.Space) { rendererData.ButtonState = PushButtonStates.Pressed; e.Table.Invalidate(e.CellRect); } }
/// <summary> /// Raises a KeyUp event for the Cell at the specified cell position /// </summary> /// <param name="cellPos">The position of the Cell</param> /// <param name="e">A KeyEventArgs that contains the event data</param> protected void RaiseCellKeyUp(CellPos cellPos, KeyEventArgs e) { if (!this.IsValidCell(cellPos)) { return; } if (!this.TableModel[cellPos].Enabled) { return; } if (this.ColumnModel.GetCellRenderer(cellPos.Column) != null) { Cell cell = null; if (cellPos.Column < this.TableModel.Rows[cellPos.Row].Cells.Count) { cell = this.TableModel.Rows[cellPos.Row].Cells[cellPos.Column]; } CellKeyEventArgs ckea = new CellKeyEventArgs(cell, this, cellPos, this.CellRect(cellPos.Row, cellPos.Column), e); this.OnCellKeyUp(ckea); } }
/// <summary> /// Raises the CellKeyUp event /// </summary> /// <param name="e">A CellKeyEventArgs that contains the event data</param> protected virtual void OnCellKeyUp(CellKeyEventArgs e) { if (this.CanRaiseEvents) { ICellRenderer renderer = this.ColumnModel.GetCellRenderer(e.Column); if (renderer != null) { renderer.OnKeyUp(e); } if (CellKeyUp != null) { CellKeyUp(e.Cell, e); } } }
/// <summary> /// Raises the KeyUp event /// </summary> /// <param name="e">A CellKeyEventArgs that contains the event data</param> public virtual void OnKeyUp(CellKeyEventArgs e) { }
/// <summary> /// Raises the KeyDown event /// </summary> /// <param name="e">A CellKeyEventArgs that contains the event data</param> public virtual void OnKeyDown(CellKeyEventArgs e) { }