TdxListItems.GetItemAtPos(TPoint) Method
Provides access to an individual list item at the specified position.
#Declaration
Delphi
function GetItemAtPos(const P: TPoint): TdxListItem;
#Parameters
Name | Type | Description |
---|---|---|
P | TPoint | A point in the client area of the parent List View control. |
#Returns
Type | Description |
---|---|
Tdx |
The list item at the target position ( The function returns |
#Remarks
Call the GetItemAtPos
function to identify a list item by a point within the parent List View control’s client area.
#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