Skip to main content

TcxGridInitEditEvent Type

The procedural type for in-place editor activation events in the Data Grid control.

Declaration

TcxGridInitEditEvent = procedure(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit) of object;

Parameters

Name Type Description
Sender TcxCustomGridTableView

Provides access to the grid View that raised the in-place editor activation event.

To access all public API members, cast the Sender parameter value to the corresponding terminal TcxCustomGridTableView class descendant.

Tip

You can call the Sender.ClassType function to identify the actual grid View type.

AItem TcxCustomGridTableItem

Provides access to the grid data item whose in-place editor is about to activate.

To access all public API members, cast the AItem parameter value to the corresponding terminal TcxCustomGridTableItem class descendant.

Tip

The actual data item type corresponds to the type of the grid View accessible through the Sender parameter. Likewise, you can call the AItem.ClassType function to identify the data item type.

AEdit TcxCustomEdit

Provides access to the in-place editor that is about to activate.

To access all public API members, cast the AEdit parameter value to the corresponding terminal TcxCustomEdit class descendant.

Tip

You can use the AItem.PropertiesClass property to identify the actual in-place editor type. Alternatively, you can call the AEdit.ClassType function or use other runtime type identification options.

Remarks

An editor activation event occurs every time the grid View is about to activate and initialize an in-place cell editor. You can handle the editor activation event to customize different in-place editor settings depending on the editor type, the target cell position and value, or any other condition in your application.

Code Examples

Disable the Mouse Wheel for an In-Place Editor

The following code example disables the mouse wheel scroll functionality for the lookup combo box used as an in-place cell editor:

procedure TMyForm.cxGridTableView1InitEdit(Sender: TcxCustomGridTableView;
  AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit);
var
  AExtLookupComboBox: TcxExtLookupComboBox;
begin
  if AEdit is TcxExtLookupComboBox then  // Checks if an in-place cell editor is a lookup combo box
  begin
    AExtLookupComboBox := AEdit as TcxExtLookupComboBox;
    AExtLookupComboBox.Properties.UseMouseWheel := False;  // Disables the mouse wheel for the in-place editor
  end;
end;

Tip

This scenario can be also useful for a TcxSpinEdit in-place editor.

Display the Drop-Down Editor Window on Activation

The following code example automatically displays the drop-down window of any TcxCustomDropDownEdit descendant used as an in-place editor every time a user invokes the editor:

procedure TMyForm.cxGridTableView1InitEdit(Sender: TcxCustomGridTableView;
  AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit);
var
  ADropDownEdit: TcxCustomDropDownEdit;
begin
  if AEdit is TcxCustomDropDownEdit then  // Checks if an in-place cell editor is a drop-down editor
  begin
    ADropDownEdit := AEdit as TcxCustomDropDownEdit;
    ADropDownEdit.DroppedDown := True;  // Opens the in-place editor's drop-down window
  end;
end;

Direct TcxGridInitEditEvent Type References

The following events reference the TcxGridInitEditEvent procedural type:

TcxCustomGridTableView.OnInitEdit
Allows you to configure an in-place cell editor before it is displayed.
TcxCustomGridTableView.OnUpdateEdit
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.
See Also