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 Sender
parameter provides access to the grid View that raised the OnUpdateEdit
event.
The AItem
parameter provides access the data item whose cell is being edited.
The AEdit
parameter provides access to the active in-place cell editor. Use its properties to customize the editor as required. You can access the active editor through the Controller.EditingController.Edit property.
Code Example
The following code example demonstrates an OnUpdateEdit
event handler that customizes 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 occurs after OnEditing and OnInitEdit events that allow you to prevent a certain cell from being edited or initialize the cell’s in-place editor value.