findObject

findObject(object: Object): Integer;

The findObject method of the ListBox and ComboBox classes searches the itemObject property values of the list entries of a list box or combo box control for the object specified in the object parameter.

If the specified object is found, its listIndex value is returned. If the specified object is not found, -1 is returned.

The findObject method searches only the entries that are currently loaded (which are the visible entries only) when the displayCollection method is used to populate the control.

The code fragment in the following example shows the use of the findObject method.

cmb_Category.listIndex := cmb_Category.findObject(myCustomer.myCategory);

The findObject method does the same as the logic in the following code fragment.

foreach indx in 1 to list1.listCount do
    if list1.itemObject[indx] = obj then
        return indx;
    endif;
endforeach;
return -1;