listObject

Type: Object

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

The listObject property contains a reference to the associated object of the currently selected item in the ComboBox or ListBox control.

Setting the listObject property selects the entry associated with the requested object. This property would normally be used only when a collection is associated with the combo box or list box.

The listObject property returns the itemObject property value of the currently selected list entry. The value that is returned is equivalent to:

obj := list1.itemObject[list1.listIndex];

If the value of the listIndex property is -1, a null object is returned.

Setting the listObject property value selects the first list entry where the itemObject property value equals the listObject property object. If there is no such list entry, an exception is raised. The value of the listIndex property is set to the selected list entry. 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).

Setting the listObject property is equivalent to:

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

Changing the listObject property (and therefore the listIndex property) from logic does not generate a click event. Setting the listObject property from logic does not change the portion of the list box that is displayed. Use the topIndex property to control the entries that are shown to the user.

The following examples show the use of the listObject property.

buttonFillLeft_click(btn: Button input) updating;
vars
    start : Time;
    count : Integer;
begin
    app.mousePointer       := self.MousePointer_HourGlass;
    start                  := app.clock.Time;
    count                  := app.myCompany.allProducts.size;
    listBoxLeft.listCollection(app.myCompany.allProducts, true, 0);
    listBoxLeft.listObject := listBoxLeft.itemObject [count];
    labelLeft.caption      := "Time Taken := " & ((app.clock.Time -
                              start).Integer/1000).String & " Seconds";
    app.mousePointer       := self.MousePointer_Arrow;
end;
    groupBoxWeb.visible        := false;
    website := listBox1.listObject.Customer.customerWebSite;
    if website <> null and currentSession <> null then
        groupBoxWeb.caption    := "Click to access Web Site";
        labelWebSite.caption   := "http://" & website;
        labelWebSite.hyperlink := "http://" & website;
    else
        groupBoxWeb.caption    := "No Web Site registered";
        labelWebSite.caption   := null;
        labelWebSite.hyperlink := null;
    endif;
...