Programming Guide |
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 insmattrib.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.
sm_d_msg_line
displays the contents ofmessage
on the status line with an initial display attribute ofdisplay_attr
. If the cursor position display is turned on (refer tosm_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 tosm_d_msg_line
, wheremessage
gets an empty string anddisplay_attr
gets 0. Once cleared, the previously overridden message redisplays. The functionsm_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
%A
nnnn
appears anywhere in the message, the hexadecimal numbernnnn
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-7:
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
%K
keyname
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 insmkeys.h
.If the message begins with a
%B
, Panther beeps the terminal (using sm_bel) before issuing the message.
/* 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);