Sign in Join
FPDoc Onlineexperiment

TListItems.Move procedure

Member of TListItemspublicIn unit ComCtrls

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

Declaration

pascal
procedure 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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.