contents.gifindex.gifprev1.gifnext1.gif

5.3 Label

gt400028.gif

The LABEL control type displays a simple string of text. Labels cannot take any input from the user and, thus, cannot be activated. Use labels to describe entry fields, or for any other situation where you need to display simple text.

Labels may occupy multiple lines. When a label is displayed on multiple lines, it will use word-wrapping if possible so that words are not broken across lines.

The set of LABEL properties includes:

Common Properties

TITLE

Labels can take titles. The text of the title is the text displayed on the screen. The "TITLE" phrase is used to specify a title. A key letter may be specified in the title (see the entry for "TITLE Phrase" in
Book 3, Chapter 6, section 6.4.9, "Common Screen Options").

VALUE

Labels cannot be activated and do not take values.

SIZE

Labels define their height by multiplying the LINES value by the height of the label's font (including any interline spacing). For example, a LINES value of "1" indicates one line of text. Labels define their width by multiplying the SIZE value by the width of the "0" (zero) character of the label's font.

When the program executes on a non-graphical system, the values specified in the CLINES and CSIZE phrases, if present, replace the values specified by the LINES and SIZE phrases.

The default value of LINES is "1". The default value of SIZE is computed by measuring the length of the label's title using the label's font and dividing by the width of the "0" character. Thus, the default width of a label exactly occupies the space its text takes up on the screen.

To get a multi-line label, set the LINES value to the number of lines wanted and the SIZE value to the desired width. SIZE specifies the width that each line of the label will occupy.

COLOR

Labels use both the foreground and background colors specified. If either is omitted, the corresponding color of the label's owning subwindow is used.

STYLES

LEFT This alignment style causes the label's text to be left-aligned in its region. By default, the label text is not justified

When either LEFT, RIGHT, or CENTER is specified at the time the label is created, the label's text is stripped of leading and trailing spaces before the default size is computed.

RIGHT This style causes the label's text to be right-aligned in its region. This will appear no differently from LEFT if the SIZE of the label does not provide any extra space for the label's text.

CENTER, CENTERED This style causes the label's text to be centered in its region. This will appear no differently from LEFT if the SIZE of the label does not provide any extra space for the label's text.

NO-KEY-LETTER This style suppresses the interpretation of "&" as a key prefix. This is useful in cases where you are assigning user-entered data to a label and want to allow values that include the ampersand ("&") character (such as "AT&T").

TRANSPARENT This style makes a label's background invisible, so that anything underneath the label shows through. TRANSPARENT is useful if you want to display a label that blends into a background having more than one color.

Special Properties

LABEL-OFFSET (numeric) Labels are frequently placed to the left of boxed entry fields. Boxed entry fields are typically taller than their labels. This produces an inconvenient problem in that labels and entry fields placed at the same row coordinate will not line up properly (the top of the label will match the top of the entry field's box instead of lining up with the field's center). The LABEL-OFFSET property adjusts for this by moving the label down the screen slightly. The value of LABEL-OFFSET specifies the amount to move the label. Its units are hundredths of rows. The default value is machine-dependent. For Windows, it is "20" (i.e., 0.20 rows). Note that you can globally affect the default value with the FIELDS-UNBOXED configuration entry.

Events

Labels do not generate events.

Examples

The following creates a simple anonymous label. The label is anonymous because the statement doesn't store the label's handle and there is no way to refer to it later in the program.

DISPLAY LABEL "Customer No:", LINE 2, COLUMN 5.

The equivalent in the Screen Section would be:

03  LABEL "Customer No:", LINE 2, COLUMN 5.

The following creates a three-line label:

DISPLAY LABEL,

TITLE MY-LARGE-TEXT
SIZE 15, LINES 3.

These Screen Section entries produce a set of labels that are all right-aligned:

03  LABEL "Date Entered:", SIZE 20, RIGHT.

03 LABEL "Date Modified:", LINE + 1,
SIZE 20, RIGHT.
03 LABEL "Date Closed:", LINE + 1,
SIZE 20, RIGHT.