else {
printf ("%s exists in positions %d:", choice, pos_cnt);
for (i = 0; i < pos_cnt; i++)
printf (" %d", pos_list[i]);
puts ("");
XtFree (pos_list);
}
13.3.3 Replacing Items
There are also a number of functions for replacing items in a List. To replace a contiguous sequence of items, use
either XmListReplaceItemsPos() or XmListReplaceItemsPosUnselected(). These functions take
the following form:
void
XmListReplaceItemsPos(list_w, new_items, item_count, position)
Widget list_w;
XmString *new_items;
int item_count;
int position;
void
XmListReplaceItemsPosUnselected(list_w, new_items, item_count,
position)
Widget list_w;
XmString *new_items;
int item_count;
int position;
These functions replace the specified number of items with the new items starting at position. The difference
between the two functions is the same as the difference between the List routines that add items selected and
unselected. XmListReplaceItemsPosUnselected() is a new routine in Motif 1.2.
You can also replace arbitrary elements in the list with new elements, using XmListReplaceItems() or
XmListReplaceItemsUnselected. These routines take the following form:
void
XmListReplaceItems(list_w, old_items, item_count, new_items)
Widget list_w;
XmString *old_items;
int item_count;
XmString *new_items;
void
XmListReplaceItemsUnselected(list_w, old_items, item_count, new_items)
Widget list_w;
XmString *old_items;
int item_count;
XmString *new_items;
These functions work by searching the entire list for each element in old_items ...