rlh2@ukc.ac.UK ("R.L.Hesketh") (05/01/90)
> > If I have a resource that is of type "WidgetList" (XtRWidgetList) can I > > find out its length? > With XtNumber. Umm. Maybe I wasn't clear enough but the value of the WidgetList resource is retrieved from a Widget dynamically using XtGetValues(). XtNumber is just a macro which uses "sizeof" to calculate the number of elements in an array. I don't see how this can help me when the value returned by the GetValues is infact a pointer to a piece of "malloc"ed memory and not static. For example: Widget w; WidgetList wl = NULL; XtVaGetValues(w, XtNchildren, &wl, NULL); if (wl != NULL) printf("%d\n", XtNumber(wl)); Always gives me "1" because it is evaluated as a compile time constant. > > i.e. Is it defined as a NULL terminated list? > No, it is an array with no empty or undefined elements. Can you point me at the definition of this in the manual (spec.)? The only definition I can find is under Section 3.4.1 - "Managing Children" of the Intrinsics manual: "typedef Widget *WidgetList" However from its use in the MIT/Xt Intrinsics (in the functions CompositeInsertChild() and CompositeDeleteChild() in Xt/Composite.c) the idea of an "array" can be inferred. Currently if I want to find the current number of Widgets on a WidgetList I must find this from another resource .. i.e. For the "XtNchildren" resource of a Composite Widget I also need to examine the "XtNnumChildren" resource ??? I would like to avoid this as it is resource specific and not resource-type specific.