itemLevel

Type: Integer array

Availability: Read or write at run time only

The itemLevel property enables the hierarchical level of each item in a ListBox control or a ComboBox control to be obtained or set.

The itemLevel property contains a reference to an array of integer values with the same number of items as returned by the listCount method. The level of an item must be in the range 1 through 63. Setting this property is ignored if the list box value of the sorted property is set to true.

The level to which an item is set is rejected if it creates an invalid hierarchy. The rules are:

The expanded state of the changed entry is set to false. All the subitems that it inherits are collapsed and made not visible. The changed item adopts a visibility that is implied by the expansion status of its parent.

Subitems that the entry lost because of the change of level adopt the visibility and expansion status derived from their new parents.

The following example shows the use of the itemLevel property.

displayEmployees(emp:   Employee;
                 level: Integer) updating;
vars
    e : Employee;
begin
    listOrg.addItem(emp.name);
    listOrg.itemLevel[listOrg.newIndex] := level;
    foreach e in emp.myEmployees do
        displayEmployees(e, level + 1);
    endforeach;
end;