The individual list elements of a list item (poplist, listbox, checkbox, and
so on) are accessed by using a set of methods on the Item
class
using a 1-based index (that is, there is no zero-element, counting starts at
1) instead of an iterator. The methods of the Item
class that work
with an index parameter are:
public int getListElementCount()
retrieves the number
property ListElementCount
(JdapiTypes.LIST_ELEMENT_COUNT_PTID
)public java.lang.String getElementLabel(int index)
retrieves
the label of a list element row belonging to a list itempublic java.lang.String getElementValue(int index)
retrieves
the value of a list element row belonging to a list itempublic void insertElement(int index, String label, String value)
inserts
a row into the list elements of a list itempublic void deleteElement(int index)
deletes a row from
the list elements belonging to a list itemInserting or deleting elements will re-index all the elements in the list subsequent to the affected element. Be careful when manipulating list item elements; there is no protection here which compares with the iterator model, so it is possible to write code which will give unexpected results or loop infinitely. For example:
... for(int i = 1; i<=item.getListElementCount(); i++) { item.insertListElement(i,"Fred","Barney"); } ...