![]() | Programming Guide | ![]() |
Writes a message to the terminal
msgmodemessage
mode- Specifies the message's format and behavior with one of these arguments:
emsg- Displays message as an error message and awaits user acknowledgement.
err_reset- Identical to
emsgexcept when the message is displayed on the status line: in that case,err_resetforces the cursor on at its current position.qui_msg- Displays message as an error message and awaits user acknowledgement. message is preceded by the
SM_ERRORstring from the message file–for example,ERROR. In GUIs, theSM_ERRORtext is also preceded by the stop icon.quiet- Identical to
qui_msgexcept when the message is displayed on the status line: in that case,quietforces the cursor on at its current position.setbkstat- Installs message as the background status line, which displays when no other message is active.
d_msg- Displays message arguments on the status line and leaves it there until cleared or replaced by another message. Text displayed using
d_msgis buffered. You can clear the buffer by anothermsg d_msgcommand that supplies an empty string("").msgd_msgdisplaces the status line message displayed bymsg setbkstat.message- One or more comma-delimited arguments that comprise the message to display. Each argument can be a string or numeric constant, or a variable. Note that
msgquery allows only one argument. All other arguments for mode allow multiple arguments.
The
msgcommand displays messages on the status line or in a popup window in one of several modes. Each mode correspond to a Panther library function. To display messages in a dialog box with standard command buttons, call sm_message_box.
By default, GUI versions of Panther always display messages in a popup window with an OK button. Character-mode Panther displays messages in a window only if the configuration variable MESSAGE_WINDOW is set to
ALWAYS. If you set this variable toWHEN_REQUIRED(the default), character-mode Panther displays messages on the status line except when these conditions occur:
- The message overflows the status line. Note that Panther prevents the message from overlapping the cursor row/column display, if it is turned on.
- The message wraps to multiple lines.
- You specify window display with the
%Wformat option.
Note: You can force display of a message to the status line on all GUI and character-mode platforms, regardless of
MESSAGE_WINDOW'ssetting, if the message contains the%Muoption, or the setup variable ER_KEYUSE is set toER_USE. Also, thesetbkstatandd_msgmodes always display messages on the status line.
Users can dismiss the error message by pressing the acknowledgement key. In a window-displayed message, OK and space bar also serve to dismiss the error message. The acknowledgement key (by default, spacebar) can be set through the setup variable ER_ACK_KEY. If the user acknowledges the message through the keyboard, Panther discards the key. You can modify this behavior for individual messages through the
%Muoption, described later.
Several setup variables determine default message presentation and behavior. For more information about these variables, refer to "Message Display" on page 2-20 in Configuration Guide. You can change these defaults at runtime through sm_option.
You can change message behavior and appearance for individual messages by embedding percent escape options in the message text. Use these options after the call to sm_initcrt; otherwise, the percent characters appear as literals.
%AattrValue- Change the display of the subsequent string to the
attrValue-specified attribute, whereattrValueis a four-digit hexadecimal value. If the string to get the attribute change starts with a hexadecimal digit (0...F), padattrValuewith leading zeros to four digits. Refer to Table 45-2 in Application Development Guide for valid attribute values.This option is valid only for messages that display on the status line. Panther ignores this option if the message displays in a window.
%B- Beep the terminal before the message displays. This option must precede the message text.
%KkeyLogical- Display key label for logical key, where
keyLogicalis a logical key mnemonic or hex value. When Panther displays the message, it replaceskeyLogicalwith the key label string defined for that key in the key translation file. If there is no label, the%Kis stripped out and the mnemonic remains. Key mnemonics are defined insmkeys.hNote: If
%Kis used in a status line message, the user can push the corresponding logical key onto the input queue by mouse-clicking on the key label text.%Md- Force the user to press the acknowledgment key (ER_ACK_KEY) in order to dismiss the error message. Panther discards the key that is pressed. If the user presses any other key, Panther displays an error message or beeps, depending on how setup variable ER_SP_WIND is set. The
%Mdoption corresponds to the default message behavior when setup variable ER_KEYUSE is set toER_NO_USE.This option must precede the message text.
%Mt[timeOut]- Force temporary display of message to the status line. Panther automatically dismisses the message after the specified timeout elapses and restores the previous status line display. Timeout specification is optional; the default timeout is one second. You can specify another timeout in units of 1/10 second with this syntax:
- #(
n)- n is a numeric constant that specifies the timeout's length. If n is more than one digit, the value must be enclosed with parentheses. For example, this statement displays a message for 2 seconds:
msg emsg "%Mt(20) Changes have been saved to database."- The user can dismiss the message before the timeout by pressing any key or mouse clicking. Panther then processes the keyboard or mouse input.
If the message is too long to fit on the status line, Panther displays the message in a window. In this case, users can dismiss the message only by choosing OK or pressing the acknowledgement key. Panther then discards any keyboard input.
This option must precede the message text. It is ignored by
setbkstatandd_msgmodes.%Mu- Force message display to the status line and permit any keyboard or mouse input to serve as error acknowledgment. Panther then processes the keyboard or mouse input.
If the message is too long to fit on the status line, Panther displays the message in a window. In this case, users can dismiss the message only by choosing OK or pressing the acknowledgement key. Panther then discards any keyboard input.
This option must precede the message text. It is ignored by
setbkstatandd_msgmodes.%N- Insert a line break. This option is invalid for
setbkstatandd_msgmodes.%W- Forces display of the message in a window. This option is ignored by
setbkstatandd_msgmodes.
// Indicate that the entry to the field state is invalid.
msg err_reset ':state is not a U.S. state'// Indicate that the current entry is being processed.
// Note that d_msg overrides delayed write and immediately
// flushes text to the screen.
msg d_msg 'Processing :name'// Ask whether the user wants to quit the current screen.
vars quitquit = sm_message_box \
('Are you ready to quit?' ,"",SM_MB_OKCANCEL,"")if quit = SM_ID_OK
return 0vars field1 message
field1 = "message"
message = "Quick brown fox"// This will display 'message' on the status line.
msg emsg field1// This will also display 'message'.
msg emsg ":field1"// This will display 'field1'.
msg emsg "field1"// This will display 'Quick brown fox'.
msg emsg :field1// These messages use percent escapes.
// Print message in red
msg emsg "%A004Stop now."msg emsg "The menu toggle is %KMTGL"
msg emsg "Enter value.%NPress XMIT."
msg qui_msg "%WInvalid password."
msg err_reset "%MdPlease enter a positive value."
sm_message_box
![]()
![]()
![]()
![]()