Skip to main content

TcxCustomGridTableView.OnEditKeyPress Event

Occurs when an alphanumeric key is pressed to change a cell editor‘s value.

Declaration

property OnEditKeyPress: TcxGridEditKeyPressEvent read; write;

Remarks

This event fires before the OnEditChanged event is generated, and enables you to perform specific actions before an ASCII character that corresponds to the pressed key is passed to a cell editor.

The Sender parameter references the View.

The AItem parameter identifies the grid item whose value is about to be edited.

The AEdit parameter references a cell editor.

The Key parameter specifies the ASCII character of the pressed key. You can replace it with a custom character to remap keys “on the fly”. The following code snippet demonstrates how this can be accomplished for the ‘&‘ (ampersand) key in text editors.

procedure TMyForm.tvEditKeyPress(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit; var Key: Char);
begin
  if(AEdit is TcxTextEdit) and (Key = '&') then
    Key := '+';
end;
See Also