itemData

Type: Integer array

Availability: Read or write at run time only

The itemData property contains a reference to an array of integer values with the same number of items as that returned by the listCount method. Each inserted entry in a ComboBox or ListBox control has an itemData property value associated with it.

Use the itemData property to associate a specific number with each item in a combo box or list box. You can then use these numbers in logic to identify the items. For example, you can use the identification number of an employee to identify each employee name in a list box.

When you fill the list box, also fill the corresponding elements in the itemData property array with the employee numbers.

Use the itemData property for an index into an array of data structures associated with items in a list box, particularly when the list box is sorted. After the item is added to the control, use the return value of the addItem property or the newIndex method to obtain the index at which the entry was added. (See also the itemObject property.)

When you insert an item into a list by using the addItem or addItemAt method, an entry is also physically inserted in the itemData property array and is initialized to zero (0).

The following example shows the use of the itemData property.

getProdNumber(): Integer;
vars
    ref : Integer;
begin
    ref := listProds.itemData[listProds.listIndex];
    return ref;
end;