ListGetItem |
Top Previous Next |
Prototype
strElement=ListGetItem(IntHandle, intIndex)
Description
Gets an element from the list
Parameters
IntHandle: integer value corresponding to the list handle
intIndex: integer value corresponding to the index of the element to get
Returned value
strElement: string corresponding to the element
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);
|