Compaq AA-PWCBD-TE Computer Accessories User Manual


 
DEC Text Processing Utility Program Development
5.2 Programming in DECwindows DECTPU
5.2.5 Using Closures
With DECwindows, you can specify a closure value for a widget. (DECwindows
documentation refers to closures as tags.) DECwindows does not define what a
closure value is; a closure is simply a value that DECwindows understands how
to recognize and manipulate so that a DECwindows application programmer can
use the value if needed in the application. For general information about using
closures in DECwindows, see the OpenVMS documentation overview.
When a widget calls back to the DECwindows application, the callback
parameters include the closure value assigned to the widget. DECwindows
allows the application to define the significance and possible values of the closure.
DECTPU supports closure values of type string and integer. Closure values are
optional for widgets used by applications layered on DECTPU. If you do not
specify a closure value, the GET_INFO (WIDGET,
"callback_parameters", array)
built-in procedure returns unspecified in the
"closure" array element. If you
create a widget without using a UIL file, the GET_INFO (WIDGET,
"callback_
parameters
", array) built-in procedure returns the closure you specified as a
parameter to CREATE_WIDGET. If you create a widget by using a UIL file, the
GET_INFO (WIDGET, "callback_parameters", array) built-in procedure returns
the closure value (if any) defined in the X Resource Manager. If none is defined,
the built-in returns unspecified.
DECTPU leaves it to the layered application to use the closure in any way the
application programmer wishes. DECTPU passes through to the application any
closure value received as part of a callback.
DECwindows EVE provides an example of how an application can use closure
values. DECwindows EVE assigns a unique closure value to every widget
instance that can be created during an EVE editing session. Each closure value
corresponds to something that EVE must do in response to the activation of
that particular widget. When an event causes DECTPU to execute EVE’s main
callback program, the GET_INFO (WIDGET,
"callback_parameters", array) built-
in procedure returns the widget activated, the reason code (the reason the widget
is calling back), and the closure associated with the particular widget instance.
EVE’s main callback program contains an array that is indexed with values
identical to the widget closure values. Each array element contains a pointer to
the EVE code to be executed in response to the corresponding widget’s callback.
EVE’s callback program uses the closure value to locate the appropriate array
index so the correct EVE routine can be executed in response to the callback.
If your layered application does not use EVE’s callback program, then its callback
program or learn sequence must have a mechanism for determining which widget
is calling back and which application code should be executed as a result.
5.2.6 Specifying Values for Widget Resources in DECwindows DECTPU
This section discusses techniques for specifying values for widget resources.
5.2.6.1 DECTPU Data Types for Specifying Resource Values
DECTPU supports the following data types with which to specify values for
widget resources:
String
Array of strings
Integer
5–10 DEC Text Processing Utility Program Development