LOTUSSCRIPT LANGUAGE


MessageBox function and statement
Example

Displays a message in a message box and waits for user acknowledgment. The function form returns a value corresponding to the button the user presses.

Function Syntax

MessageBox ( message [ , [ buttons + icon + default + mode ] [ , boxTitle ] ] )

Statement Syntax

MessageBox message [ , [ buttons + icon + default + mode ] [ , boxTitle ] ]

The MessageBox function and statement are identical, except that only the function has a return value.

MsgBox is acceptable in place of MessageBox.

Elements

message


buttons icon default mode boxTitle
Return value

The MessageBox function return value is an integer in the range of 1 to 7, inclusive. This value indicates which button the user pressed in the message box, as shown in the following table.
Return valueButtonConstant
1 OKIDOK
2 CancelIDCANCEL
3 AbortIDABORT
4 RetryIDRETRY
5 IgnoreIDIGNORE
6 YesIDYES
7 NoIDNO

Usage

The valid values for the buttons, icon, default, and mode elements listed in the preceding tables are defined as constants in the file LSCONST.LSS. If you want to use the constants instead of numbers, include this file in your script.

The Lotus software where you are running LotusScript may allow longer strings than described above for message and boxTitle. LotusScript will support longer strings for these items if the Lotus software does.

Note The length of message is dependent on the operating system. If you are launching applications in a mixed environment (for example, PC and Mac), keep your message length equal to or shorter than the smallest limit of the operating systems to be used.

Use the newline character to force line breaks in the message element. Or use vertical bars or braces to specify a multiline string. If you don't force line breaks, the text wraps automatically in the message box.

Note Newline does not mean either chr(10) or chr(13) on all platforms. Newline is the character or sequence of characters that is used to mark the end of a line. This may be chr(10), or chr(13), but it may also be something else, because the actual value of newline depends on the platform. If newlines are desired in the output, it is the programmer's responsibility to ensure that the string contains the correct newline for the platform.

If you are using LotusScript from within Lotus Notes, note that the MessageBox function writes to:

Note Whenever a MessageBox function is executed in the back end, it will return zero, regardless of the defaults or modes. Only the prompt is displayed. The display goes to the server console, Notes log, and anywhere that debugging output is redirected (DEBUG_OUTFILE) if on a server, or to the debug console if on the client. This does not appy to the MessageBox statement.

Example
See Also