DISPLAY TO
The DISPLAY TO
instruction displays data to form fields explicitly.
Syntax
DISPLAY expression [
,...]
TO field-spec [
,...]
[
ATTRIBUTES ( display-attribute [
,...]
) ]
{
field-name
|
table-name.*
|
table-name.field-name
|
screen-array[line].*
|
screen-array[line].field-name
|
screen-record.*
|
screen-record.field-name
}
[
,...]
{
BLACK |
BLUE |
CYAN |
GREEN
|
MAGENTA |
RED |
WHITE |
YELLOW
|
BOLD |
DIM |
NORMAL
|
REVERSE |
BLINK |
UNDERLINE
}
- expression is any expression supported by the language.
- field-name is the identifier of a field of the current form.
- table-name is the identifier of a database table of the current form.
- screen-record is the identifier of a screen record of the current form.
- screen-array is the screen array that will be used in the form.
Usage
A DISPLAY TO
statement copies the data from program variables to the form fields
specified after the TO
keyword.
When the program variables do not have the same names as the form fields, you must use the
TO
clause to explicitly map the variables to form fields using a screen record or screen array. You can list
the fields individually, or you can use the screen-record.*
or
screen-record[n].*
notation, where
screen-record[n].*
specifies all the fields in line n
of a
screen array.
p_items
program record are displayed in the
first row of the s_items
screen
array:DISPLAY p_items.* TO s_items[1].*
DISPLAY
keyword. Identifiers and their corresponding fields
must have the same or compatible data types. For example, the next DISPLAY
statement displays the values in the p_customer
program record in fields of the
s_customer
screen
record:DISPLAY p_customer.* TO s_customer.*
p_customer
program record and the
s_customer
screen record require compatible declarations. The following
DEFINE
statement declares the p_customer
program
record:DEFINE p_customer RECORD
customer_num LIKE customer.customer_num,
fname LIKE customer.fname,
lname LIKE customer.lname,
phone LIKE customer.phone
END RECORD
s_customer
screen
record:ATTRIBUTES
f000 = customer.customer_num;
f001 = customer.fname;
f002 = customer.lname;
f003 = customer.phone;
END
The DISPLAY TO
instruction is usually not needed if the program is always in the
context of a dialog controlling the form fields.
DISPLAY TO / BY NAME changes the touched flag
The DISPLAY TO / BY NAME
statement changes the modification flag of the target fields. After
displaying a field value with a DISPLAY TO / BY NAME
instruction, the FIELD_TOUCHED()
operator returns true and
the ON CHANGE
and ON ROW CHANGE
triggers may be
invoked, if the current field value was changed.
In dialogs controlling field input such as INPUT
or INPUT
ARRAY
, use the UNBUFFERED
attribute to display data to fields automatically without changing the
'touched' status of fields. The UNBUFFERED
clause will perform automatic form field
and program variable synchronization. When using the UNBUFFERED
mode, the touched
flag can be set with DIALOG.setFieldTouched()
, if you want to get the same effect
as a DISPLAY TO / BY NAME
.
Specifying TTY attributes in the DISPLAY statements
The ATTRIBUTES
clause temporarily overrides any default display attributes or
any attributes specified in the OPTIONS
or OPEN WINDOW
statements
for the fields. When the DISPLAY TO / BY NAME
statement completes execution, the
default display attributes are restored. In a DISPLAY TO / BY NAME
statement, any
screen attributes specified in the ATTRIBUTES
clause apply to all the fields that
you specify after the TO
keyword.
In GUI mode, form elements can also be decorated with presentation styles. Pay attention to the specific rules that apply when combining TTY attributes and presentation styles.
The REVERSE
, BLINK
, INVISIBLE
, and
UNDERLINE
attributes are not sensitive to the color or monochrome status of the
terminal, if the terminal is capable of displaying these intensity modes. The
ATTRIBUTES
clause can include zero or more of the BLINK
,
REVERSE
, and UNDERLINE
attributes, and zero or one of the other
attributes. That is, all of the attributes except BLINK
, REVERSE
,
and UNDERLINE
are mutually exclusive.
The DISPLAY TO / BY NAME
statement ignores the INVISIBLE
attribute, regardless of whether you specify it in the ATTRIBUTES
clause.