INSERT LIST ITEM

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 2003 (Modified)


INSERT LIST ITEM (list; beforeItemRef | *; itemText; itemRef{; sublist; expanded})

ParameterTypeDescription
listListRefList reference number
beforeItemRef | *Longint | *Item reference number or
0 for the last item added to the list or
* for the currently selected list item
itemTextStringText for the new list item (max. 255 characters)
itemRefLongintUnique reference number for the new list item
sublistListRefOptional sublist to attach to the new list item
expandedBooleanIndicates 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

APPEND TO LIST.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next