Light-pen fields are alphanumeric fields that may be selected by the
operator with the selector pen feature. In this case, "select" means
"mark as modified."
Descriptive data may be assigned to light-pen fields (using ASCPUT), but
the fields are always protected on the screen so that no data may be
entered. The first data position of each row of a light-pen field contains
a designator character. This is a visible indication of whether a field
has been selected.
There are four different types of light-pen field:
- Light-pen select fields have initially a ? in the first data position
of every row. The ? designator characters are inserted by GDDM and
replace the first data byte. So, if you want a prompt of TOTAL
PROFITS, you must issue:
CALL ASCPUT(8,14,' TOTAL PROFITS');
The field then appears on the screen as ?TOTAL PROFITS. When the
operator selects such a field with the light-pen, the ? changes into a
> but no interrupt is caused.
Several such fields may be selected (and data may be typed into fields
other than light-pen fields) before the operator causes an interrupt,
for instance, by pressing the ENTER key. All modified and selected
fields are now returned to GDDM. See "Processing an alphanumeric
field with changed status" in topic 13.5 for information on how to
process the returned fields.
A selection of this type of field does not cause an interrupt (thereby
completing a screen read), they are known as deferred light-pen
fields.
- Light-pen enter fields have initially an & in the first data position
of every row (again set by GDDM). When one such field is selected, an
interrupt is caused immediately. The ASREAD that is satisfied by this
interrupt returns with its first parameter (the type of interrupt) set
to 0. In other words, the same type of interrupt as when the ENTER
key is pressed. Such fields are known as pen-enterable fields.
- Light-pen attention fields have initially a blank character in the
first data position of each row (set by GDDM). They are similar to
pen-enterable fields except that a different type of interrupt is
caused when they are selected.
Note: Selection of a light-pen attention field destroys the data of
all unprotected fields on the screen.
Light-pen attention fields should therefore not be mixed with
alphanumeric data-entry fields.
- General light-pen fields may be set to any one of the previous three
types by setting the designator character appropriately (for each row
of the field). In other words, the program sets the designator
character as part of the field's data (using ASCPUT), rather than
defining the type of light-pen field explicitly and letting GDDM
insert the designator characters. For example:
CALL ASCPUT(1,14,'?TOTAL PROFITS').
Alphanumeric fields may be specified as being any of the above four types
by setting the last parameter of the ASDFLD call:
/* FIELD_ID, ROW, COLUMN, DEPTH, WIDTH, TYPE */
CALL ASDFLD(1, 3, 4, 1, 7, 3); /* Define lightpen */
/* attention field */
The same parameter settings may be used to change the type of a field,
using the ASFTYP call. (See "Setting the attributes of alphanumeric
fields" in topic 5.7.1.)
There are a few points to note on light-pen fields in general:
- Where a field has more than one row, the whole field becomes selected
whichever row is addressed by the light-pen.
- The hardware imposes several restrictions on the positioning of
light-pen fields:
- All light-pen fields must be at least 3 characters long.
- No light-pen field may begin in column 1.
- If there is another field to the left of the light-pen field,
there must be a separation of at least four columns.
Following a screen read, the processing of light-pen fields is similar to
that for other types of alphanumeric field as shown in Figure 76 in
topic 13.1. Selected fields are marked as modified and may be determined
by a call to ASQMOD.
|