version 2003 (Modified)
INSERT LIST ITEM (list; beforeItemRef | *; itemText; itemRef{; sublist; expanded})
Parameter | Type | Description | |
list | ListRef | List reference number | |
beforeItemRef | * | Longint | * | Item reference number or | |
0 for the last item added to the list or | |||
* for the currently selected list item | |||
itemText | String | Text for the new list item (max. 255 characters) | |
itemRef | Longint | Unique reference number for the new list item | |
sublist | ListRef | Optional sublist to attach to the new list item | |
expanded | Boolean | Indicates if the sublist will be expanded or collapsed |
Description
The INSERT LIST ITEM command inserts the item designated by the itemRef parameter in the list whose reference number you pass in list.
The beforeItemRef parameter can be used to designate the item before which you wish to insert the new item:
You can pass the value 0 in order to designate the last item added to the list. The newly inserted item will then become the selected item.
You can pass * in order for the new item to be inserted before the currently selected item in the list. In this case, the newly inserted item will also become the selected item.
Otherwise, if you want to insert an item before a specific item, you pass the item reference number of that item. In this case, the newly inserted item is not automatically selected. If there is no item with the corresponding item reference number, the command does nothing.
You pass the text and the item reference number of the new item in itemText and itemRef.
If you want for the item to include subitems, pass a valid list reference number in the sublist parameter. In this case, you must also pass the expanded parameter. Pass either True or False in this parameter so that this sublist is displayed either expanded or collapsed respectively.
Example
The following code inserts an item (with no attached sublist) just before the currently selected item in the hList list:
vlUniqueRef:=vlUniqueRef+1 INSERT LIST ITEM(hList;*;"New Item";vlUniqueRef) REDRAW LIST(hList)
See Also