IListView.SelectedItem

Syntax

SelectedItem: IListViewItem;

Description

The SelectedItem property determines the selected component element.

Comments

If the MultiSelect property is set to True, SelectedItem returns the last selected element.

Example

Executing the example requires a form, the Button1 button on the form, and the ListView component named ListView1.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Items: IListViewItems;
Begin
    Items := ListView1.Items;
    ListView1.SelectedItem := Items.Item(1);
    ListView1.SelectedItem := Items.Item(2);
    ListView1.SetFocus;
End Sub Button1OnClick;

After executing the example pressing the button selects the second and third elements of the ListView1 component.

See also:

IListView