MESSAGEBOX()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to display a dialog box with user-defined elements

Syntax

MESSAGEBOX(<expC1> [, <expN> [, <expC2>]])

See Also

DIALOG BOX, ETOS(), INPUTBOX(), JavaScript built-in Lianja/VFP functions, WRITEOUTPUT()

Description

The MESSAGEBOX() function is used to display a dialog box with user-defined elements. The message, title, icon and buttons can all be defined.

Parameters Required Default Description
<expC1> Yes None The message to display in the message box.
<expN> No 0 A number representing the buttons and icon to include in the message box and the specification of the default button. See the tables below for details.
<expC2> No Lianja The title of the message box.

Buttons

Value Buttons
0 Ok
1 Ok and Cancel
2 Abort, Retry and Ignore
3 Yes, No and Cancel
4 Yes and No
5 Retry and Cancel

Icons

Value Icon
16 Stop road sign
32 Question mark
48 Exclamation mark
64 Information sign


Default

Value Buttons
0 First button
256 Second button
512 Third button

The <expN> is the sum of the values to be specified, one from each table. For example, if <expN> is 292, the message box will have Yes and No buttons (4), a Question mark icon (32) and the second button (No) will be the default (256).

Return Values

The MESSAGEBOX() function returns a number signifying the selected button:

Return Value Buttons
1 Ok
2 Cancel
3 Abort
4 Retry
5 Ignore
6 Yes
7 No

For message boxes that include the Cancel button, pressing the Escape key will also cause the MESSAGEBOX() function to return 2.

Example

nReturn = messagebox("Are you sure?", 36, "Continue to next screen")
if nReturn = 6
    // user selected 'Yes', process accordingly
else
    // user selected 'No', process accordingly
endif