getListIndex

getListIndex(x: Real;
             y: Real): Integer;

The getListIndex method of the ListBox class returns the index of the displayed list entry in the list box corresponding to the position specified by the x and y parameters (in units specified by the value of the scaleMode property), provided that the specified position corresponds to any point on the associated entry line of the item within the list box.

If the position specified by the horizontal and vertical x and y parameters does not correspond to a displayed list entry, a value of -1 is returned. For example, you can use this method during the mouseMove method to determine the entry that the mouse is passing over.

The method in the following example shows the use of the getListIndex method.

listInstances_mouseMove(listbox: ListBox input;
                        button:  Integer;
                        shift:   Integer;
                        x, y:    Real) updating;
vars
    cust : Customer;
begin
    if listbox.getListIndex(x, y) <> -1 and
        listbox.getListIndex (x, y) <> lastIndex then
        cust := listbox.itemObject[listbox.getListIndex(x, y)].Customer;
        listbox.bubbleHelp := cust.name.toUpper & Cr
                    & "________________________________________" & Cr
                    & cust.address & Cr & cust.contact;
        lastIndex := listbox.getListIndex(x, y);
    endif;
    if listbox.getListIndex (x, y) = -1 then
        listbox.bubbleHelp := null;
    endif;
end;