[comp.windows.x] Getting a list of a widgets resources at run-time?

montnaro@spyder.crd.ge.com (Skip Montanaro) (07/28/90)

We use a locally developed interpretive object-oriented system called LYMB.
LYMB has classes that interface to both the HP and MOTIF widgets. On more
than a few occasions, it would be useful to ask an object for a list of the
X resources it understands. For instance, I'd like to be able to type the
following short script at the interpreter to jog my memory about what
resources I can set or get.

	motif_button new: b;

	b print: resources?;

Functionality similar to this would be useful for error detection also:

	b @ "some-resource" grok?;

At the C level is there a way to get a list of resources a widget
understands at run-time, or query a widget to see if it knows about a
specific resource?

Thx,

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

rlh2@ukc.ac.uk (Richard Hesketh) (07/28/90)

In article <MONTNARO.90Jul27144346@spyder.crd.ge.com> montanaro@crdgw1.ge.com (Skip Montanaro) writes:

>At the C level is there a way to get a list of resources a widget
>understands at run-time, or query a widget to see if it knows about a
>specific resource?

Try using XtGetResourceList() and (in R4 only) XtGetConstraintResourceList().
(use XtClass() to get the widget's class).

>Skip (montanaro@crdgw1.ge.com)

Richard Hesketh   :   @nsfnet-relay.ac.uk:rlh2@ukc.ac.uk
		  :   rlh2@ukc.ac.uk    ..!mcsun!ukc!rlh2
---                                               
Computing Lab., University of Kent at Canterbury,
Canterbury, Kent, CT2 7NF, United Kingdom.    Tel: +44 227 764000 ext 7620/3682

marbru@auto-trol.UUCP (Martin Brunecky) (07/30/90)

In article <MONTNARO.90Jul27144346@spyder.crd.ge.com> montanaro@crdgw1.ge.com (Skip Montanaro) writes:
>
>We use a locally developed interpretive object-oriented system called LYMB.
>LYMB has classes that interface to both the HP and MOTIF widgets. On more
>than a few occasions, it would be useful to ask an object for a list of the
>X resources it understands. 

Depends great deal how "correct" you want to be. Each widget class has
a pointer to resource list. You can look it up (note, it may be "compiled"
into quarks). Similarly, you can find constraint resources.
This, however, does NOT address any "sub resources", such as those used
by R3 Athena Text widget, there is no formal way to find any of those. 

Another problem are enumerated data types (and/or defines). Ususally, it
does not do me any good to find that resource has a value of 3 unless
I know that 3 means something like "resize policy grow". Resource lists
could have had a pointer to a "values table", which could have
been used by a universal resource converter - but it's not there ....

-- 
=*= Opinions presented here are solely of my own and not those of Auto-trol =*=
Martin Brunecky                   marbru@auto-trol.COM
(303) 252-2499                    {...}ncar!ico!auto-trol!marbru
Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404