[comp.windows.x] Question regarding XtGetResourceList & XtGetConstraintResourceList

montnaro@spyder.crd.ge.com (Skip Montanaro) (05/08/91)

I have the following code in an application:

    XtGetResourceList(XtClass(instance->id), &resources, &count);

where instance->id is of type Widget, resources is of type XtResourceList,
and count is of type Cardinal.

The function always returns the widget-specific data back, as opposed to the
class-specific data. How does XtGetResourceList know what the widget id is,
since it's getting a WidgetClass as input, not a Widget?

I have a similar call to XtGetConstraintResourceList:

    XtGetConstraintResourceList(XtClass(instance->id), &resources, &count);

It always sets resources to NULL, even if the widget specified by
instance->id is a child of an XmForm widget. Am I calling it incorrectly?

Thx,

--
Skip (montanaro@crdgw1.ge.com)

rlh2@ukc.ac.uk (R.L.Hesketh) (05/09/91)

In article <MONTNARO.91May8095931@spyder.crd.ge.com> montanaro@crdgw1.ge.com (Skip Montanaro) writes:
>    XtGetResourceList(XtClass(instance->id), &resources, &count);

>The function always returns the widget-specific data back, as opposed to the
>class-specific data. How does XtGetResourceList know what the widget id is,
>since it's getting a WidgetClass as input, not a Widget?

I'd be extremely surprised if it did!  You are getting back the
class-specific data .. by this I think you mean the default_type and
default_address?   These will be correct for the WidgetClass given.
The resource value of a particular widget instance may indeed have the
same value as that returned by XtGetResourceList but this is because it
has been created with the class default value.

>    XtGetConstraintResourceList(XtClass(instance->id), &resources, &count);
>
>It always sets resources to NULL, even if the widget specified by
>instance->id is a child of an XmForm widget. Am I calling it incorrectly?

No you must give it the Class of the constraint parent, i.e.

     if (XtParent(instance->id) != NULL)
	     XtGetConstraintResourceList(XtClass(XtParent(instance->id)),
							 &resources, &count);

Richard