4 using callbacks – Compaq DEC Text Processing Utility AA-PWCBD-TE User Manual
Page 107
DEC Text Processing Utility Program Development
5.2 Programming in DECwindows DECTPU
5.2.3.4 Response to Requests for Information About the Global Selection
DECTPU provides a three-level hierarchy for responding to requests from another
application for information about the current selection. Applications layered on
DECTPU may specify a routine that responds to requests for information about
global selections either for the entire application or for one or more buffers in the
application.
When DECTPU receives a request for information, it checks whether there is a
routine for the current buffer that responds to information about global selections.
If no buffer-specific routine is available, DECTPU checks for an application-
wide routine. If no application-wide routine is available, DECTPU can provide
information only about the primary selection, the file name, font, line number,
and text.
DECTPU responds to all other requests with a message that no information
is available. DECTPU does not send requests for information about the global
selection to other DECwindows applications. DECTPU applications may use the
various built-in procedures to do so.
DECTPU’s responses to requests for information about the primary selection are
as follows:
"
FILE_NAME
"
DECTPU responds with the string returned by the GET_INFO
(CURRENT_BUFFER,
"
file_name
"
) built-in procedure.
"
FONT
"
DECTPU responds with the string returned by the GET_INFO
(SYSTEM,
"
default_font
"
) built-in procedure.
"
LINE_NUMBER
"
DECTPU responds with the value of type span containing the
record number where the select range starts and the record
number where the select range ends.
"
TEXT
"
or
"
STRING
"
DECTPU responds with the text of the select range as a string,
with each line break represented by a line feed.
Compaq recommends that you use only a DECwindows section file with
DECwindows DECTPU. However, if you do not follow this recommendation,
DECTPU’s automatic grabbing of the primary global selection enables your
layered application to interact with other DECwindows applications.
If an application requests information about the primary global selection while
DECTPU owns the selection, DECTPU attempts to respond to the request if
the application cannot do so. If DECTPU responds to the request by sending
the text of a buffer or range, DECTPU converts the buffer or range to a string,
converts line breaks to line feeds, and inserts padding blanks before text to
fill any unoccupied space between the margins. If neither the application nor
DECTPU can respond to the request, DECTPU informs DECwindows that the
requested information is not available.
DECTPU does not automatically grab the secondary selection. Layered
applications are responsible for handling this selection.
5.2.4 Using Callbacks
This section presents background information on the DECwindows concept of
callbacks and explains how DECwindows DECTPU implements this concept.
DEC Text Processing Utility Program Development 5–7