[comp.windows.x] Arrays in widget resources

swick@ATHENA.MIT.EDU (Ralph R. Swick) (12/29/88)

    Date: 22 Dec 88 15:18:14 GMT
    From: pwcs!eta!nurk@umn-cs.arpa  (Tom Nurkkala)

    I would like to be able to use the SetValues/GetValues
    calls to reference specific elements of this array

SetValues/GetValues can handle arbitrarily structured data (such
as arrays) principally because they don't need to know the actual
structure of the resource.  Trying to do an operation such as array
indexing which requires intimate knowledge of the resource structure
is going to be hard.  One possible way is to declare two additional
"virtual resources", say XtNindex and XtNelement, which the client
can specify simultaneously in an arglist and to declare set_values_hook
and get_values_hook procedures in the widget class which perform the
necessary indexing operation given these two values.

It would seem to be much easier to export additional public functions
from your widget class to access individual array components.  Unless
you have a particular application requirement to use the generic
SetValues/GetValues interface to access pieces of a resource, why bother?