MESSAGE Function
Create a message box.
ReplyToMessage(TITLE_SV, MESSAGE_SV, OPTIONS_IV, DEFAULT_OPTION_IV, ICON_IV)
TITLE_SV
A string value that you want to appear as the title of the message box.
MESSAGE_SV
A string value that is the text of the message.
OPTIONS_IV
One of the following integer constants, indicating the replies from which the user can choose:
MessageOK
MessageAbortRetryIgnore
MessageOKCancel
MessageYesNo
MessageRetryCancel
MessageYesNoCancel
MessageCancelTryContinue
DEFAULT_OPTION_IV
An integer value (1-3) that specifies the option that is the default for the OPTION_SV specified.
indicates that the first option is the default;
indicates that the second option is the default.
For example, specifying 2 with the MessageYesNo option indicates that the default option is "no".
ICON_IV
One of the following integer constants to indicate the icon that appears in the message box.
MessageQuery
MessageNoIcon
MessageWarning
MessageCritical
MessageInformation
If you do not want an icon, specify;
MessageNoIcon
Description
The ReplyToMessage( ) function allows you to create a message box. Message boxes are a quick and easy way to send a message and receive a reply (for example, to request confirmation when the user asks to quit the ESL session).
Unlike other ESL objects, message boxes are temporary. Instead of creating them and responding to them using the ESL language as you would a key or a region, you make just one function call that creates and displays the message box you specify. Users must respond to the message box before performing any other ESL actions (such as selecting other objects). Once ESL receives the response, it removes the message box from the screen and returns the user's response to the ESL program.
This function returns a lowercase string that is the text of the option taken in the message box. For example, if a message box specifies the options MessageAbortRetryIgnore and the user selects the "Retry" option, the function returns the string "retry".
When calling the function, you can select different values for each parameter to get a different message box each time.
For example, specifying MessageYesNo means the message box will present the user with two options: yes and no. These options also determine the possible return values of the function. Because ReplyToMessage( ) returns the option the user selected, the possible return values when you specify MessageYesNo are yes and no. (Note: If an error condition occurs, "error" may be returned instead; "error" is always a possible return value.)
Note that the comparison strings "yes," "no," and "ok" must be all lowercase characters.
Example
This example defines a message box to double check that the user really does want to quit before exiting:
include "message.inc"
response to Quit
if ( ReplyToMessage("Quit",
"Do you really want to Quit?",
MessageYesNo,
2,
MessageNoIcon) = "yes") then
exit
end if
This example defines a message box that displays a different confirm-quit message. It has "ok" as the default rather than "no", the second option is "cancel", and an exclamation point appears for emphasis.
response to Quit
if (ReplyToMessage("You have selected the Quit function.",
"Exiting your program...",
MessageOKCancel,
1, MessageWarning) = "ok") then
exit
end if
See Also
ReplyToMessageWithHelp( ) MESSAGE Function
ReplyToMessageWithHelpButton( ) MESSAGE Function