ListView_ItemAdd()

Examples


The ListView_ItemAdd() function adds an item to a list view field.

Syntax

ListView_ItemAdd(list_view_field, label, data {, image}{, state_image})

Parameters

list_view_field – The list view field to which a new item is being added.

label – A string specifying the text that will appear with the item.

data – A long integer specifying the data value to associate with the item.

image – An optional integer specifying the picture to display with the item. The value corresponds to the item number of an item image listed in the ListView Images window.

state_image – An optional integer specifying the state image to display with the item when the list view is shown in report view mode. The value corresponds to the item number of a state image listed in the ListView Images window.

Return value

A long integer containing the index of the new list view item.

Comments

Be aware that the index of an item may change. For example, when the list is re-sorted, a list view item may appear in a different location in the list. Thus, its index value will have changed.

Each new item is added to the bottom of the list, regardless of the sorting option specified for the list view field. After adding new list view items, you can use the ListView_Sort() function to re-sort the entire list.

To add subitems to the list view item, use the ListView_ItemSetSubitem() function.


Documentation Feedback