TcxCustomGridTableView.OnInitEdit Event
Enables you to customize an in-place cell editor.
Declaration
property OnInitEdit: TcxGridInitEditEvent read; write;
Remarks
This event occurs every time an in-place editor is about to open. Handle this event to customize the editor opened for a grid View cell. To prevent activation of an in-place cell editor under specific conditions, handle the OnEditing event instead.
The Sender parameter provides access to the grid View that raised the OnInitEdit event.
The AItem parameter returns a grid item whose cell is being edited.
The AEdit parameter provides access to the activated cell editor. Cast the parameter value to the corresponding editor class to access all editor-specific class members. You can use the grid View’s Controller.EditingController.Edit property to access an in-place cell editor when it is active.
The following code example shows the pop-up window of an in-place drop-down editor every time it is invoked.
procedure TMyForm.cxGridTableView1InitEdit(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit);
begin
if AEdit is TcxCustomDropDownEdit then // Checks if an in-place cell editor is a drop-down editor
TcxCustomDropDownEdit(AEdit).DroppedDown := True; // Opens the drop-down editor's pop-up window
end;
Note
If you need to show different in-place editors for different records in the same grid item, handle the item’s OnGetProperties event. To initialize the activated in-place cell editor’s value, handle the OnInitEditValue event.