Programming Guide



sm_d_msg_line

Displays a message on the status line

void sm_d_msg_line(char *message, int display_attr);

message
A pointer to the message to display. To clear the message previously displayed with this function, supply an empty string.

display_attr
The display attribute to use for message, one of the constants defined in smattrib.h. A value of 0 clears the message previously displayed with this function.

Foreground colors can be used alone or OR'd together with one or more highlights, a background color, and a background highlight. If you do not specify a highlight or a background color, the attribute defaults to white against a black background. Omitting a foreground color causes the attribute to default to black.


Description

sm_d_msg_line displays the contents of message on the status line with an initial display attribute of display_attr. If the cursor position display is turned on (refer to sm_c_vis), the end of the status line contains the cursor's current row and column.

Messages displayed with sm_d_msg_line override both background and field status text. They remain on all screens until you clear the status line with another call to sm_d_msg_line, where message gets an empty string and display_attr gets 0. Once cleared, the previously overridden message redisplays. The function sm_d_msg_line is itself overridden by sm_ferr_reset and related functions, or by the ready/wait message enabled by sm_setstatus.

Several percent escapes let you control the content and presentation of status messages. The character that follows the percent sign must be in uppercase. Note that if a message containing percent escapes is displayed before sm_initcrt is called, the percent escapes appear in the message.

If a string of the form %Annnn appears anywhere in the message, the hexadecimal number nnnn is interpreted as a display attribute to be applied to the remainder of the message. Use numeric values to specify the logical display attributes you need to construct embedded attributes. These values are specified in Table 5-5:

Table 5-5 Panther color/attribute mnemonics

Foreground Attributes* Background Attributes
Attribute Mnemonic Hex Code Attribute Mnemonic Hex Code

REVERSE

0010

B_HILIGHT

8000

UNDERLN

0020

BLINK

0040

HILIGHT

0080

DIM

1000

Foreground Colors Background Colors

BLACK

0000

B_BLACK

0000

BLUE

0001

B_BLUE

0100

GREEN

0002

B_GREEN

0200

CYAN

0003

B_CYAN

0300

RED

0004

B_RED

0400

MAGENTA

0005

B_MAGENTA

0500

YELLOW

0006

B_YELLOW

0600

WHITE

0007

B_WHITE

0700

NORMAL_ATTR

0007

B_CONTAINER

4000

* Attributes are additive. One or more foreground attributes can be added to a background attribute, foreground color and background color.

If you want a digit to appear immediately after the attribute change, pad the attribute to 4 digits with leading zeros. If the following character is not a legal hex digit, then leading zeros are unnecessary.

If a string of the form %Kkeyname appears anywhere in the message, keyname is interpreted as a logical key constant, and the whole expression is replaced with the key label string defined for that key in the key translation file. If there is no label, the %K is stripped out and the constant remains. Key constants are defined in smkeys.h.

If the message begins with a %B, Panther beeps the terminal (using sm_bel) before issuing the message.

Example

/* The following prompt uses labels for the EXIT and
* return keys, and underlines crucial words. */

sm_d_msg_line("Press %KEXIT to %A0027abort%A7, "
"or %KNL to %A0027continue%A7.");

/* To clear the status line, use: */

sm_d_msg_line("", 0);

See Also

sm_ferr_reset, sm_msg