Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxListItem.Caption Property

Specifies the list item caption.

#Declaration

Delphi
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