TListItems.Exchange procedure
Exchanges the positions for the specified list items in the container.
Declaration
procedure Exchange(const AIndex1: Integer; const AIndex2: Integer)Arguments
AIndex1 | Ordinal position for a list item moved in the method. |
AIndex2 | Ordinal position for a list item moved in the method. |
Description
Exchange is a method used to swap the positions for the list items
specified in the AIndex1 and AIndex2 arguments. No actions are performed in
the method when AIndex1 and AIndex2 have the same values.
An Exception is raised if AIndex1 or AIndex2 contain a value that is not a valid ordinal position in the container. (< 1 or > Count-1).
Values in the Selected and ItemFocused properties for the list view control are saved prior to swapping the list items. 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.
Exchange calls the TFPList.Exchange method to change the positions
for the specified list items in the internal storage for the container. The
list item in AIndex1 becomes the active cache item after the values have been
swapped. The widgetset class for the list view control is notified of the
change when its handle is allocated.
Use Move to relocate a list item to a specific ordinal position 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 AIndex1 or AIndex2 contain a value that is not a valid ordinal position in the container.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
