IList Base Interface

Being a descendent of IBasic the interface "IList" is the base interface for all kinds of list interfaces. Only the properties that apply to all list interfaces are introduced here. If you want to have a good overview you might want to look at the IList Reference.

type IList = interface (IBasic) ['{F6B8D483-40DB-11D3-A52D-00005A180D69}'];

The most important property of a list is probably, how many items it contains:

property IList.ItemCount : integer;

Then we have the "Capacity" property, which tells us how many items our list can hold without being forced to reallocate. Generally this property should not be very interesting for you. It's important only if you build your own descendents from IList.

property IList.Capacity : integer;

Some lists may happen to have "nil" items, some may not. Anyway, the following method removes all "nil" items, if any:

procedure IList.Pack;

One important feature of lists is sorting. However, sorting is quite dependent of the list type. So in our base interface we can only introduce some parts of sorting mechanism. The property "SortDown" says whether the list is sorted normally or upside down. The property "SortInfo" has no special meaning. It can be set and then later asked by the custom sorting procedure.

property IList.SortDown : boolean;
property IList.SortInfo : integer;

If you're using the same list object in more than one thread at the same time, you need to synchronize access to it. For this purpose you can use the both built in functions "Lock" and "Unlock". They're realized internally by a ICriticalSection object.

procedure IList.Lock;
function  IList.Unlock : boolean;

The following properties are useful mainly when you show the list's items in a TListView. "SelectedCount" tells you how many items are selected in the TListView component. "FocusedItem" tells you which of the items is currently focused. And "LastFocusedItem" is needed for multiple selections.

property IList.SelectedCount   : integer;  
property IList.FocusedItem     : IBasic;
property IList.LastFocusedItem : IBasic;