Caution: This version of this document is no longer maintained. For the latest documentation, see


Add items to a list


void PtGenListAddItems( PtWidget_t *list, 
                        PtGenListItem_t *items,
                        PtGenListItem_t *after );


This function adds items to the PtGenList widget pointed to by list. The arguments are:

A pointer to a list of PtGenListItem_t structures linked with the next field (the prev field is ignored).
If after is NULL, add the items at the beginning of the list. If after isn't NULL, it must point to an item in the widget and items is added after that item.

In all selection modes except Pt_SELECTION_MODE_RANGE, if there's no current item in the widget and some of the added items have the Pt_LIST_ITEM_CURRENT flag set, the first of them becomes the current item (see Current item in the description of PtGenList). In all other items, the flag is cleared.

If no item is currently selected and the mode is set to Pt_SELECTION_MODE_SINGLE, the first of the added items having the Pt_LIST_ITEM_SELECTED flag set becomes the selected item. This flag on all other items is cleared.

In Pt_SELECTION_MODE_MULTIPLE mode and Pt_SELECTION_MODE_NONE mode, all items with the Pt_LIST_ITEM_SELECTED flag are selected.

In Pt_SELECTION_MODE_RANGE mode, the behavior depends on whether there's a selected range in the widget and how the after item is located relative to the selected range. In particular, if you remove a range of items and then reinsert them in the same place, the selected range is restored. However, the “direction” of the range may be reversed.

If no items are selected in Pt_SELECTION_MODE_RANGE mode but a range of added items has the Pt_LIST_ITEM_SELECTED flag set, these items become the selected range. The first or last item in this range becomes the current item, depending on the setting of the Pt_LIST_ITEM_CURRENT flag of the first selected item.



Interrupt handler No
Signal handler No
Thread No

See also:

PtGenList, PtGenListItem_t