Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

Motif FAQ (Part 5 of 9)
Section - 110) How do I best put a new set of items into a list?

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Counties ]


Top Document: Motif FAQ (Part 5 of 9)
Previous Document: 109) Should I create an XmList widget as a child of automatic
Next Document: 111) Can I have strings with different fonts in a list?
See reader questions & answers on this topic! - Help others by sharing your knowledge

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.

User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: Motif FAQ (Part 5 of 9)
Previous Document: 109) Should I create an XmList widget as a child of automatic
Next Document: 111) Can I have strings with different fonts in a list?

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
kenton@rahul.net (Ken Lee)





Last Update March 27 2014 @ 02:11 PM