Skip to main content

TdxListViewCreateItemClassEvent Type

The procedural type for list item creation handlers.

Declaration

TdxListViewCreateItemClassEvent = procedure(Sender: TdxCustomListView; var AItemClass: TdxListItemClass) of object;

Parameters

Name Type Description
Sender TdxCustomListView

The List View control that raised the event.

AItemClass TdxListItemClass

A class-reference to the added item class. The assigned class should be a descendant of the TdxListItem class.

Remarks

The following code specifies a TdxListItem class descendant whose instances store their time of creation and the ListView’s OnCreateItemClass event handler that adds the custom-defined item instead of the standard item:

type
  MyItem = class(TdxListItem)
  private
    Created: TDateTime;
  public
    constructor Create(AOwner: TdxListItems); virtual;
end;

constructor MyItem.Create(AOwner: TdxListItems);
begin
  inherited Create(AOwner);
  Created := Now;
end;

procedure TForm1.dxListViewControl1CreateItemClass(Sender: TdxCustomListView;
  var AItemClass: TdxListItemClass);
begin
  AItemClass := MyItem;
end;

The List View’s OnCreateItemClass event references the TdxListViewCreateItemClassEvent type.

See Also