Skip to main content

TcxCustomGridTableView.OnUpdateEdit Event

Enables you to respond to switching the edit mode for the grid or updates to the record being edited with a cell’s in-place editor.

Declaration

property OnUpdateEdit: TcxGridInitEditEvent read; write;

Remarks

The View generated the event is passed as the Sender parameter.

AItem specifies the item whose cell is being edited.

The AEdit parameter represents the activated cell editor. Use its properties to customize this editor as required. When the editor is open, you can access it via the View’s Controller.EditingController.Edit property.

The following code snippet shows how to handle the OnUpdateEdit event to customize the appearance of a CheckBox column’s cell being edited based on its checked state.

procedure TMyForm.cxGridDBTableView1UpdateEdit(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit);
var
  ACheckBox: TcxCheckBox;
begin
  if AEdit is TcxCheckBox then
  begin
    ACheckBox = TcxCheckBox(AEdit);
    if(ACheckBox.Style.Checked) then
      ACheckBox.Style.Color := clGreen;
    else
      ACheckBox.Style.Color := clRed;
  end;
end;

The OnUpdateEdit event fires after the OnEditing and OnInitEdit events, which enable you to prohibit editing or initialize a cell’s in-place editor, respectively.

See Also