Combining TTY and style attributes

TTY attributes can be specific to a form element or can be inherited by an element from a parent node (such as the form or window).

Specific element TTY attributes are directly set in the element node in the AUI tree; they can, for example, be defined with the COLOR attribute of form items. Inherited TTY attributes are taken from the parent nodes of the leaf element to be displayed. For example, when a form is displayed with DISPLAY FORM followed by an ATTRIBUTE clause containing TTY color, font option and/or video attributes, all static labels will be displayed with the TTY attributes of the form. Note however that the form elements controlled by interactive instructions (i.e. form fields) will explicitly get the TTY attributes defined by the ATTRIBUTE clause of OPEN WINDOW, OPEN FORM, DISPLAY TO / BY NAME or the current dialog statement, and must be considered specific TTY attributes for the element.

Specific TTY attributes defined for a form element have a higher priority than style attributes, while inherited TTY attributes (set on one of the parent elements) have a lower priority than style attributes defined for the element.

To illustrate this rule, imagine a form defining two static labels and two fields, with all items using the mystyle presentation style, and one of the labels and fields defining a specific TTY attribute with COLOR=BLUE:
LABEL lab01: TEXT="Field 1:", COLOR = BLUE, STYLE = "mystyle";
EDIT fld01 = FORMONLY.field01, COLOR = BLUE, STYLE = "mystyle";
LABEL lab02: TEXT="Field 2:", STYLE = "mystyle";
EDIT fld02 = FORMONLY.field02, STYLE = "mystyle";
The program displays the form (or window) with an ATTRIBUTES clause using a red color, and the fields are used by an INPUT dialog, with no ATTRIBUTES clause, so the default TTY attributes are gotten from the OPEN FORM instruction:
OPEN FORM f FROM "ttyform"
DISPLAY FORM f ATTRIBUTES(RED)
INPUT BY NAME field01, field02 WITHOUT DEFAULTS
The .4st styles file defines the mystyle attributes as follows:
<StyleList>
  <Style name="Edit.mystyle">
    <StyleAttribute name="textColor" value="green" />
  </Style>
  <Style name="Label.mystyle">
    <StyleAttribute name="textColor" value="magenta" />
  </Style>
</StyleList>

The text in the form field fld01 is displayed in blue (from the specific COLOR attribute), while fld02 is displayed in red (the TTY attribute of the form, the style Edit.mystyle being ignored).

Since labels are not used by the interactive instructions, lab01 is displayed in blue (from the specific COLOR attribute), while lab02 is displayed in magenta (from the style Label.mystyle, the form TTY attribute red being ignored).