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

# TListItems.Move

Moves the list item at the specified position to a new position in the container.

## Declaration

Source position: comctrls.pp line 1174

`public procedure TListItems.Move(`
`const AFromIndex: Integer;`
`const AToIndex: Integer`
`);`

## Arguments

`AFromIndex` |  | Ordinal position for the list item on entry.
`AToIndex` |  | Ordinal position for the list item after it has been relocated.

## Description

Move is a method used to relocated a list item at a specified position to a new position in the container. The original position is specified in AFromIndex. The new position is specified in AToIndex.

An Exception is raised if AFromIndex or AToIndex contain a value that is not a valid ordinal position in the container. (&lt 1 or &gt Count-1).

Values in the Selected and ItemFocused properties for the list view control are saved prior to moving the list item. These properties are restored prior to exiting from the method. Flags in the list view control are updated to include lffItemsMoving when the operation is started. The flag value is removed when the operation is completed.

Move calls the TFPList.Move method to change the positions for the specified list item in the internal storage for the container. The list item in AToIndex becomes the active cache item after the item has been moved. The widgetset class for the list view control is notified of the change when its handle is allocated.

Use Exchange to swap the positions for two list items in the container.

Use InsertItem to insert a list item at a specific position in the container.

## Errors

Raises an Exception with the message in rsListIndexExceedsBounds if AFromIndex or AToIndex contain a value that is not a valid ordinal position in the container.

## See also

TListItems.Exchange |  | Exchanges the positions for the specified list items in the container.
TListItems.InsertItem |  | Inserts the specified list item at the specified position in the internal storage for the container.
TCustomListView.Selected |  | Contains the selected list item in the list view control.
TCustomListView.ItemFocused |  | The list item which has focus on the control.
TListViewFlag |  | Represents flag values used in TCustomListView when sorting or validating items in the control.
TListViewFlags |  | Set type used to store values from the TListViewFlag enumeration.