vcl-cxgridcustomtableview-cdd2c6fe.md
The procedural type for in-place editor activation events in the Data Grid control.
TcxGridInitEditEvent = procedure(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit) of object;
| 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.
|
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.
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;
void __fastcall TMyForm::cxGridTableView1InitEdit(TcxCustomGridTableView *Sender,
TcxCustomGridTableItem *AItem, TcxCustomEdit *AEdit)
{
TcxExtLookupComboBox *AExtLookupComboBox;
if(AEdit->ClassType(__classid(TcxExtLookupComboBox))) // Checks if an in-place cell editor is a lookup combo box
{
AExtLookupComboBox = dynamic_cast<TcxExtLookupComboBox*>(AEdit);
AExtLookupComboBox->Properties->UseMouseWheel = false; // Disables the mouse wheel for the in-place editor
}
}
Tip
This scenario can be also useful for a TcxSpinEdit in-place editor.
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;
void __fastcall TMyForm::cxGridTableView1InitEdit(TcxCustomGridTableView *Sender,
TcxCustomGridTableItem *AItem, TcxCustomEdit *AEdit)
{
TcxCustomDropDownEdit *ADropDownEdit;
if(AEdit->InheritsFrom(TcxCustomDropDownEdit)) // Checks if an in-place cell editor is a drop-down editor
{
ADropDownEdit = dynamic_cast<TcxCustomDropDownEdit*>(AEdit);
ADropDownEdit->DroppedDown = true; // Opens the in-place editor's drop-down window
}
}
The following events reference the TcxGridInitEditEvent procedural type:
TcxCustomGridTableView.OnInitEditAllows you to configure an in-place cell editor before it is displayed.TcxCustomGridTableView.OnUpdateEditEnables 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
TcxGridInitEditValueEvent Procedural Type