itemForeColor

Type: Integer array

Availability: Read or write run time only

The itemForeColor property allows the text color of each item in a ListBox or ComboBox control to be assigned. The itemForeColor property contains a reference to an array of integer color values (integer, 1-relative) with the same number of items as that returned by the listCount method.

Each entry in the list automatically assumes the text color assigned to the control assigned by the foreColor property. However, you can individually assign each item its own text value.

The following example shows the use of the itemForeColor property.

setColor(prod: Product) updating;
begin
    if prod.inStock then
        listProducts.itemForeColor[listProducts.newIndex] := Red;
    else
        listProducts.itemForeColor[listProducts.newIndex] := Gray;
    endif;
    if listProducts.newIndex.isEven then
        listProducts.itemBackColor[listProducts.newIndex] := LightYellow;
    endif;
end;