ListCount

Top  Previous  Next

Prototype

 

intTotal:=ListCount(IntHandle)

 

Description

 

Returns a list elements number

 

Parameters

 

IntHandle: integer value corresponding to the list handle

 

Returned value

 

intTotal: integer value corresponding to the list elements number

 

Notes

 

None.

 

Example

 

//It creates a new list

HandleList:=ListCreate; 

 

//It adds element to the list

ListAddItem(HandleList,'Element 1');

ListAddItem(HandleList,'Element 2');

ListAddItem(HandleList,'Element 3');

 

//It counts list element

TotalElements:=ListCount(HandleList);

ShowMessage('The element counted are: '+IntToStr(TotalElements));

 

//It finds element Index

IndexElements:=ListIndexOfItem(HandleList,'Element 2');

ShowMessage('Element 2 is in position '+IntToStr(IndexElements));

 

//It deletes an element

if (IndexElements>=0) and (IndexElements<TotalElements)

then ListDelete(HandleList,IndexElements);

 

//It destroys the list

ListDestroy(HandleList);