Skip to main content

TdxListItem.Caption Property

Specifies the list item caption.

Declaration

property Caption: string read; write;

Property Value

Type Description
string

The list item caption.

Remarks

Use the Caption property to define the list item’s caption. Users can click the focused list item or press F2 to activate an in-place caption editor if the parent List View control is not in read-only mode.

Code Example: Display Clicked Item Captions

The code example in this section demonstrates an OnMouseDown event handler that displays the clicked list item‘s caption in the application form’s title bar:

procedure TMyForm.dxListViewControl1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  ATargetItem: TdxListItem;
begin
  if Button = mbLeft then
  begin
    ATargetItem := dxListViewControl1.Items.GetItemAtPos(Point(X, Y));
    if ATargetItem <> nil then
      Caption := 'Target Item is ' + ATargetItem.Caption;
  end;
end;
See Also