listIndex

Type: Integer

Availability: Not available at design time, read or write at run time

The listIndex property contains the index of the currently selected item in the ComboBox or ListBox control. The settings of the listIndex property are listed in the following table.

Value Description
ItemNotFound (-1) Indicates no item is currently selected (the default). For a combo box control, it also indicates the user has entered new text into the text box portion of the combo box.
n A number indicating the index of the currently selected item.

The text property and itemText property [list1.listIndex] return the string for the currently selected item.

The first item in the list is listIndex 1, and the last entry is the same number of items as that returned by the listCount method.

Changing the listIndex property from logic does not generate a click event.

Setting the listIndex property from logic changes the portion of the list box that is displayed. (You can also use the topIndex property to control the entries that are shown to the user.)

When multiple items are currently selected, the value of the listIndex property is the last of the items selected. One or more items can be selected, with the value of the listIndex property being none of those items (for example, when you select an item, press the Shift key and select another item, then press the Ctrl key and remove the selection of one of the previously selected items).

For details about automatically controlling a ComboBox control assigned to a Table control as a cellControl property (for example, when performance is an issue when running in JADE thin client mode over a slow link), see the Control class automaticCellControl property.

The following example shows the use of the listIndex property.

listProducts_dblClick(listBox: ListBox);
vars
    pd : ProductDisplay;
begin
    if listProducts.itemText[listProducts.listIndex] <> "" then
        create pd;
        pd.fault := app.myCompany.allProducts.getAtKey(getProdNumber);
        pd.centreWindow;
        pd.showModal;
    endif;
end;