Next: Selecting and Deselecting items Up: List basics Previous: List basics

Adding and removing list items

To add an item to list use XmListAddItem() with 3 arguments:

The List Widget
- to be added to,
- an XmString,
- The (int) position. Starts at index 1!!. Position 0 is used to specify the last position in list.

Another function XmListAddItemUnselected() has exactly the same syntax as above. This function will guarantee that an item is not selected when it is added. This is not always the case with the XmListAddItem().

To remove a single item from a List use XmListDeleteItem(Widget, XmString).

To remove a number of items use XmListDeleteItems(Widget, XmString*).

If you know the position of item(s) you could use: XmListDeletePos(Widget, int) or XmListDeleteItemsPos(Widget, int num, int pos).

The latter deletes num items starting at position pos.

To delete all items form a list use XmListDeleteAllItems(Widget)
Tue May 24 16:52:56 BST 1994