[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'ComCtrls' (#lcl)

# TCustomListView.GetNextSelected

Indicates whether a list item following the list item at the specified position can be authoritatively selected for the list view control.

## Declaration

Source position: comctrls.pp line 1655

`public function TCustomListView.GetNextSelected(`
`LVIndex: Integer;`
`var AItem: TListItem`
`):Boolean;`

## Arguments

`LVIndex` |  | Ordinal position in the multi-selection list for list items examined in the method.
`AItem` |  | Returns the next selected TListItem instance for the control, or Nil when none of the Items in the control are selected.

## Function result

Returns True if another item is selected in multi-select or owner data (virtual) modes.

## Description

GetNextSelected is a Boolean function used to indicate whether a list item following the specified position in the list view can become the selected item in the method. It indicates that the Selected property can be updated with the detected list item based on the settings for the list view control.

The return value is False if neither OwnerData nor MultiSelect are enabled for the list view control.

The return value is True if the variable parameter in AItem was successfully updated with a TListItem instance in the method. This can be one of the Items in the current multi-selection list, the next owner data list item for the control, or Nil when the multi-selection list is empty or OwnerData is not enabled.

GetNextSelected visits each of the Items for the control following the position specified in LVIndex. It checks whether the Selected property for the list item is enabled, and when found, updates AItem with the TListItem instance found in the method. If a subsequent list item is not found that is selected, AItem is set to Nil.

GetNextSelected is used in the widgetset implementation of the GetNextItem method.

## Version info

Added in LCL version 4.4.

## See also

TCustomListView.GetNextItem |  | Gets the next list item in the given direction from the starting item.
TCustomListView.Items |  | Collection of list items displayed on the list view control.
TCustomListView.MultiSelect |  | Allows simultaneous selection of one or more list items using Ctrl+Click, Shift+Click, Ctrl+Shift+Click, or using program code.
TCustomListView.OwnerData |  | Enables or disables owner data (virtual) mode for the list view control.
TCustomListView.Selected |  | Contains the selected list item in the list view control.
TCustomListView.SelCount |  | Number of currently selected Items when MultiSelect is enabled.
TListItem.Selected |  | Whether this Item has been Selected (often denoted by a check-mark).
TListItems |  | Implements a container for list items on a list view control.