version 6.0
DELETE LIST ITEM (list; itemRef | *{; *})
| Parameter | Type | Description | |
| list | ListRef | List reference number | |
| itemRef | * | Number | * | Item reference number, or | |
| * for current selected list item | |||
| * | If specified, clear sublists (if any) from memory | ||
| If omitted, sublists (if any) are not cleared |
Description
The command DELETE LIST ITEM deletes an item from the list whose list reference number is passed in list.
If you pass * as second parameter, you delete the current selected item in 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 command APPEND TO LIST.
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 (possible) sublist attached to the item, because eventually you will have to delete it, using the command CLEAR LIST.
Example
The following code deletes the current selected item of the list hList. If the item has an attached sublist, the sublist (as well as any sub-sublist) is cleared:
DELETE LIST ITEM(hList;*;*) REDRAW LIST(hList) ` Do NOT forget to call REDRAW LIST otherwise the list won't be updated
See Also