Attribute (Screen)

From Br Wiki
Jump to: navigation, search

See also: Attribute (disambiguation)

The "attributes" parameter represents a set of specifications that identify the visual and control aspects of a screen display. Attributes are used primarily in full screen processing statements, but they may also be used in help text files (see Help Facility for more information about this usage). We begin with examples to put the following syntax in context. This wiki serves as documentation for legacy applications as well as current technology, so some of the syntax (where noted) has been deprecated.

Comments and Examples

In the following example, "r" indicates that the message to be printed is to be reversed (highlighted). (Line 2005 is included because it's best to start a new page before printing new lines and accepting new input).

02005 PRINT NEWPAGE
02010 PRINT FIELDS "10,30,c 16,r": "Enter Customer #"

In the next example, "ae" indicates that as soon as the last digit of input is entered or one of the exit keys is used, the program is to perform an automatic Enter:

02020 INPUT FIELDS "10,48,n 5,ae": CUSTNUM

In the next example, color is added. Line 2030 displays the message "Enter Date" with control attributes that are ignored because they are irrelevant for PRINT FIELDS. Line 2040 displays a field with red letters on a blue background:

02030 PRINT FIELDS "12,30,c 16,cae": "Enter Date"
02040 RINPUT FIELDS "12,48,c 8,/r:b": DateSold$

Business Rules is designed to handle the mixing of monochrome and color attributes and selects the appropriate attributes for the current monitor (unless a color system has been specified as COLOR N in the BRConfig.sys file). Your programs may then use color when it is available, but require no code changes when they are moved from one type of monitor to another. However, in newer versions of BR, the majority of monochrome attibutes (such as blinking) are no longer supported. In the following example, line 80 produces a highlighted field when a monochrome monitor is in use. When a color monitor is being used, it produces red letters on a teal background:

00080 PRINT FIELDS "2,2,C 7,h/r:bg":" HELLO"

Syntax

Screenattributes.png

Defaults

  1. N (normal).
  2. Grey background.

Parameters

The syntax diagram shows four columns of specifications, which are labeled as monochrome, control, foreground color and background color attributes.

Monochrome Attributes

Older versions of BR used monochrome attributes to describe the visual characteristics of fields on a monochrome screen. When both monochrome and color attributes are specified in the same statement, Business Rules selects the appropriate attributes according to the type of screen that is used at start- up. The following monochrome attributes may have been used in older programs, but no longer function in current versions of BR:

B Blink.
H Highlighted (or high intensity).
R Reversed (dark letters on light background).
U Underlined.

Certain monochrome attributes are still in use, specifically:

I Invisible (non-display). This makes the specified INPUT or RINPUT field hidden. This attribute is used in situations (such as with a password) where the information that the operator types in should not be reproduced on the screen. Instead, it’s replaced with dots or asterisks as the user enters it.
N Normal display (grey background; no blinking, highlighting, underlining, or reversing). When this attribute is specified along with other monochrome attributes, the other attributes take precedence.
R Reversed now highlights a field only if no colors have been specified.
S Used only with PRINT FIELDS, makes the field appear “sunken” (with a shadow outline), just like the INPUT FIELDS default appearance. See also Sunken Appearance.


Control Attributes

Control attributes modify the operation of the screen. They have meaning only with INPUT FIELDS and RINPUT FIELDS statements; PRINT FIELDS ignores them. The following control attributes may be specified:

A Automatic advance to the next field after data entry to the last position in this field in multiple field processing.
C Cursor is to be placed in this input field first. C is used only when multiple input fields are coded from the same statement. When C is not specified, the cursor is positioned at the first field in the field specification array. If C is specified for more than one field, the cursor is positioned in the last field of the array containing the C attribute.
E Automatic enter when data is entered or changed in a field and the FIELDPLUS (Ctrl-U) key is pressed or the field is exited. (The only keys that will not cause an automatic enter after data has been entered or changed are the arrow keys.)
' This feature is useful for Verifying codes stored in a related file. For example, if vendor number changes, display the new company name; if vendor number does not change, do not bother to read the vendor file.
G Automatic enter of screen when entering this field (does not await key entry). This feature directs the system to read the screen without operator response.
L The field attribute L pertains to only the first and last field of a FIELDS array. It works like X (auto enter) if and only if the cursor is moved out of the array. That is, L has no effect unless the up arrow is pressed while in the first field, or the down arrow is pressed while in the last field, in which case it returns control to the program with an Fkey Value of 102, 103, or 104 (up-arrow, left-arrow, or down-arrow).
This is used only for first and last fields on an input select statements and allows you to scroll up and down out of the array.
P Protected field. This feature causes the cursor to skip over the field (no input is allowed). Possible uses for this attribute include protecting the key field in an update program, allowing only certain users to edit certain fields for security reasons, and setting up automatic field skipping for fields that operators choose to never use (tax code, for instance). Error code 0866 will result if all fields are protected fields.
Q This will make a field become a "Hot Text Field" , it is followed by a parameter that defines what value will be returned when activated. Even linedraw characters can be "hot".
S Creates a sunken field effect. Not active in 4.17 in the GUI mode. In PRINT mode in 4.17 this will create a blue line around a white background. In input or rinput mode this will have no effect.
T Tab key moves cursor to next field.
X This will cause the "Enter Key" to be pressed when you exit the field. Special control attributes exist for field processing. "E" emulates the pressing of Enter when a field is exited with the Field Plus or Field Minus key. The two control attributes "AE" can be combined to create an Enter when the last position of a field is filled. This combination, however, will not create an enter if the field is exited with an arrow or mouse click.
The control attribute X has been added for error processing in FIELDS and SELECT statements. X causes FIELDS statements to quit processing whenever the field with an X is exited. The difference between X and AE is that X will simulate an enter no matter what key is used to exit the field, whereas AE will not simulate the enter if the operator simply arrows up or down through the field without changing data.
The X control attribute has the affect of turning the INPUT FIELDS instruction into a single-field input operation (all other fields are effectively ignored for operator input). It is especially useful when used with CURFLD to reject invalid data from an input field. The operator must respond with correct data before any other information can be entered. See the example in the CURFLD function discussion for more information.
# The # symbol represents an actual number which is coded as an attribute that identifies the starting cursor position within a field.


The following example shows how the cursor can be positioned on the third character of a date field. Since only the middle field of a date (mmddyy format) is typically changed, this feature saves time for the operator.

01100 RINPUT FIELDS "10,40,n 6,u3": SHIPDATE

In the following example, an entire 24 by 80 screen is treated as one field and the cursor is positioned at location 1841, which is column 1 of row 24:

01100 RINPUT FIELDS "1,1C 1920,R1841": A$


Color foreground attributes

Foreground color attributes must follow all the monochrome and control attributes, and must be separated from the preceding attributes by a forward slash (/). They identify the visual characteristics of the field foreground when it is displayed on a color monitor (in a given field, the characters within the field are the foreground and the space behind the characters is the background). When both color and monochrome attributes are specified for a field, Business Rules selects the appropriate attributes according to the monitor used at start-up.

Foreground color attributes are specified by the following list of single letter codes
R Red.
G Green.
B Blue.
H Highlight.
W Windows default color
#RRGGBB Beginning with 4.x foreground and background colors can be designated using the 6 digit HTML color codes preceeded with a pound sign #FF0000 causes the text to be RED

Note that beginning with BR4.17 a color attribute of "N" is no longer allowed and will create an error condition.


Color background attributes

Background color attributes must be separated from foreground attributes by a colon (:). They identify the visual characteristics of the field background when it is displayed on a color monitor (in a given field, the characters within the field are the foreground and the space behind the characters is the background).

Background color attributes are specified by the following list of single letter codes (NOTE that H actually affects the foreground when it is specified with background attributes):

R Red.
G Green.
B Blue.
H Foreground blink.
T Transparent
W Windows default color
#RRGGBB Beginning with 4.x foreground and background colors can be designated using the 6 digit HTML color codes preceeded with a pound sign #FF0000 causes the background to be RED

Technical Considerations

When multiple foreground color or background color attributes are coded, the following combinations will result:

BG (blue + green) = light blue
RB (red + blue) = purple
RG (red + green) = yellow
BGR (blue + green + red)= white

See also HTML color codes

Color Specifications

When processing field attributes, processing is done left to right. Nothing may follow color specifications in FIELDS attributes, whereas color specifications in attribute statements may be followed by a colon and further attributes such as fontname.

As the FIELDS attributes are being processed left to right, if an ATTRIBUTE statement is referenced (e.g. [STRONG]) then all attributes are cleared and the referenced attribute statement is processed. Then the remainder of the FIELDS attributes are processed.

It may be that both color and font are specified by an ATTRIBUTE statement, but it is desired to override just the color. This can be accomplished by referring to an ATTRIBUTE statement and then following it with a color specification. In that case the FIELDS color attribute will override entirely the ATTRIBUTE color specification.

Also, within a color specification it is permissible to have multiple seemingly conflicting color specifications such as /HRW:RG#112233. In these cases the priority given to conflicting specifications is:

  1. #112233 style values
  2. W (Windows system)
  3. HRGB values

There is no point in specifying both W and #112233 values because the #112233 values always take priority. However it can be useful to specify both HRGB and one of the other specifications so that HRGB will be used by terminal emulators but will be ignored by graphical clients.

Inactive fields

Inactive fields in 4.X+ versions default to the Windows inactive colors (usually grey on grey) This can be overridden by setting the attribute "[INACTIVE]" to the desired color behavior.

e.g. ATTRIBUTE [INACTIVE]N/W:#FFFFFF

This will set inactive fields to the windows foreground default (typically black) on a white background (4.16+)