itemObject

Type: Object array

Availability: Read or write at run time only, read-only when a collection is attached to a combo box or list box

The itemObject property enables you to store an object with each entry in a ListBox or ComboBox control, and with each cell of a Table control. This then allows logic to retrieve that object when the user clicks on the entry. For example, for each customer shown in a list, a reference to the Customer object can be stored with the list entry.

Each inserted entry in a ComboBox and ListBox control has an itemObject property value associated with it. The itemObject property contains a reference to an array of object values with the same number of items as the listCount method of a control.

Each cell of a table control has an itemObject property value associated with it.

For ComboBox and ListBox controls, use the itemObject property array indexed by the required entry. For Table controls, the itemObject property refers to the currently selected cell defined by the sheet, row, and column properties.

When you insert an item into a list by using the addItem or addItemAt method, a null object entry is also inserted in the itemObject property array.

As the object reference that is stored is of the Object class, it may then need to be cast to the required class so that it can be used.

An itemObject reference is not a true collection but a wrapper that allows you to use the [ ] syntax when referencing the window definition of a control (for example, table.itemObject[indx]) and in an iterator (for example, foreach obj in listBox.itemObject). The Collection classes they point to are internal pseudo arrays (that is, arrays of GUI‑related information only in the JADE run time module), in which the only methods that are implemented are the Collection class size and size64 methods, and the Array class at, atPut, and createIterator methods. No other collection methods are implemented. (For details, see the ListBox, ComboBox, and Table classes.)

To search row, column, or cell objects, use the findObject method.

The following example shows the use of the itemObject property.

bDelete_click(btn: Button input) updating;
vars
    prod    : Product;
    company : Company;
begin
    if listProducts.listIndex = -1 then
        app.msgBox("You must make a selection", "Error", 0);
        return;
    endif;
    beginTransaction;
        prod := listProducts.itemObject [listProducts.listIndex].Product;
        delete prod;
    commitTransaction;
end;

When the items in a combo box or list box are determined by using the listCollection method or displayRow event method, the value of the itemObject property is automatically assigned to the collection entry associated with the list entry. This value cannot be changed.