Parent document is top of "Motif FAQ (Part 5 of 9)"
Previous document is "117) Should I create an XmList widget as a child of automatic"
Next document is "119) Can I have strings with different fonts in a list?"

118) How do I best put a new set of items into a list?

Answer:  Set the new list count and list by XtSetArgs and install them by
XtSetValues.

    XmString list[SIZE];
    int list_size;

    XtSetArg (args[n], XmNitemCount, list_size); n++;
    XtSetArg (args[n], XmNitems, list); n++;
    XtSetValues (w, args, n);


or similarly with XtVaSetValues:


    XtVaSetValues (w,
       XmNitemCount, list_size,
       XmNitems, list,
       NULL);


Each time the list is reset by this the old contents are freed by the widget
and the new supplied list is copied.  Do *not* free the old list of items
yourself as this would result in the space being freed twice.  It is not
necessary to remove the items one at a time, nor to "zero" out the list first.

Parent document is top of "Motif FAQ (Part 5 of 9)"
Previous document is "117) Should I create an XmList widget as a child of automatic"
Next document is "119) Can I have strings with different fonts in a list?"