getListIndexText

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

The getListIndexText 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 is within the itemText text portion of the list entry.

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.

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

vars
    indx : Integer;
begin
    indx := listbox.getListIndexText(x, y);
    if indx > 0 and indx <> lastListIndex2 then
        lastListIndex2     := indx;
        listbox.bubbleHelp := "Entry # " & indx.String;
    endif;
end;