Compaq DEC Text Processing Utility AA-PWCBD-TE User Manual
Page 112
DEC Text Processing Utility Program Development
5.2 Programming in DECwindows DECTPU
Setting Resources
When you use the SET (WIDGET) built-in procedure to pass a list to a widget,
you must specify both the list name and the list count resource in the same array
index, separated by a line feed (ASCII (10)). The array element should be the
array that is to be passed. For example, to specify the
"
items
"
resource to the list
box widget, use code similar to the following:
line_feed := ASCII (10);
resource_array {"items" + line_feed + "itemsCount"}:=list_array;
The line-feed character, ASCII (10), is a delimiter that separates two resource
names.
DECTPU automatically generates two resource entries. The first is the array of
strings that specifies the data to the list box for the
"
items
"
resource. The second
is the count of elements in the array for the
"
itemsCount
"
resource.
Getting Resources
To get resource values from a widget, use the following statement:
GET_INFO (widget, "WIDGET_INFO", array)
The indices of the array parameter are strings or string constants that name
the resources whose values you want. (The initial values in the array are
unimportant.) The GET_INFO statement directs DECTPU to fetch the specified
resource values of the specified widget and put the values in the array.
For list box widgets or file selection widgets, one element of the array receives
another array that contains the list manipulated by the widget. The indices
of this array are of type integer. The lowest index has the value 0, and each
subsequent index is incremented by 1. The contents of the array elements are of
type string.
When you create the index of the element that receives the widget’s list, you must
observe the same naming convention as for setting resources so that DECTPU
can handle both the list itself and the resource value that specifies the length of
the list. Give the index the following format:
items
For example, if you used GET_INFO (widget,
"
WIDGET_INFO
"
, array) to get
resource values from a list box widget, you could specify the index for the element
storing the widget’s list as follows:
"items" + ASCII(10) + "itemsCount"
The element for the widget’s list does not actually contain an array until after
execution of the GET_INFO statement. When DECTPU encounters the GET_
INFO statement, it parses the indices of the specified array. When DECTPU
parses the index of the element for the widget’s list, it fetches both the list itself
and the length of the list. Using the resource specifying the length, DECTPU
creates an array of the correct size to hold the widget’s list.
See the DEC Text Processing Utility Reference Manual for sample uses of
DECwindows DECTPU built-ins.
5–12 DEC Text Processing Utility Program Development