vcl-dxlistview-93a1d259.md
The procedural type for list item creation handlers.
TdxListViewCreateItemClassEvent = procedure(Sender: TdxCustomListView; var AItemClass: TdxListItemClass) of object;
| 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.
|
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;
class MyItem : TdxListItem
{
private:
TDateTime Created;
public
__fastcall virtual MyItem(TdxListItems *AOwner : TdxLiostItem(AOwner)
{
Created = Now();
}
}
void __fastcall TForm1::dxListViewControl1CreateItemClass(TdxCustomListView *Sender,
TdxListItemClass &AItemClass)
{
AItemClass = __classid(MyItem);
}
The List View’s OnCreateItemClass event references the TdxListViewCreateItemClassEvent type.
See Also