version 2003 (Modified)
DELETE LIST ITEM (list; itemRef | *{; *})
Parameter | Type | Description | |
list | ListRef | List reference number | |
itemRef | * | Longint | * | Item reference number, or | |
0 for the last item added to the list or | |||
* for the currently selected list item | |||
* | If specified, erases sublists (if any) from memory | ||
If omitted, sublists (if any) are not erased |
Description
The DELETE LIST ITEM command deletes the item designated by the itemRef parameter of the list whose reference number is passed in list.
If you pass * in itemRef, you delete the currently selected item in the list. You can also pass 0 in this parameter in order to request the deletion of the last item added to the list.
Otherwise, you specify the item reference number of the item you want to delete. If there is no item with the item reference number you passed, the command does nothing.
If you work with item reference numbers, build a list in which the items have unique reference numbers, otherwise you will not be able to distinguish the items. For more information, see the description of the APPEND TO LIST command.
No matter which item you delete, you should specify the optional * parameter to let 4D automatically delete the sublist attached to the item, if any. If you do not specify the * parameter, it is a good idea to have previously obtained the list reference number of the sublist (if any) attached to the item, so that you can delete it, if necessary, using the CLEAR LIST command.
Example
The following code deletes the currently selected item of the list hList. If the item has an attached sublist, the sublist (as well as any sub-sublist) is deleted:
DELETE LIST ITEM(hList;*;*) REDRAW LIST(hList) ` Do NOT forget to call REDRAW LIST; otherwise the list won't be updated
See Also