addItemAt(str: String; index: Integer);
The addItemAt method adds a specified item index to a ComboBox or ListBox control or adds a new row to a Table control at run time.
The parameters of the addItemAt method are listed in the following table.
Parameter | Description |
---|---|
str | The string expression to add to the control. For Table controls only, use the tab character (character code 09) to separate multiple strings that you want inserted into each column of a newly added row. |
index | An integer representing the position within the control where the new item or row is placed. For the first item in a list box or combo box, or for the first row in a table control, the index is 1. |
The addItemAt method places the item at that specified position within the control. If the sorted property value is set to true, this may upset the sorting process.
Adding an entry can result in the value of the topIndex and listIndex properties for a list box being changed because of the addition. For a Table control, the row, column, leftColumn, and topRow properties can change as a result of the addition.
For the ListBox class, which uses a hierarchy, the following applies.
Entries added to the end of the list of entries have an itemLevel property value of 1 and are automatically visible within the hierarchy.
Entries inserted within the list adopt the level of the entry at which the insertion occurs. This means that they become leaves, having no subitems. They adopt the same visibility as the entry at which the insertion occurs.
For the Table class, the following applies.
A new row is added to the table.
The first cell in the row is filled with the text that is passed. If the text contains tab characters, each tab character is assumed to be the end of the text for a cell, and the next cell is then filled with the remainder of the text, and so on. If all cells are filled and there is more text, that text is discarded.
No sorting is performed, but the insertion of a row may still affect other property values.