MSGBOX() Function - Create Message Box Dialog

Syntax

MSGBOX(str1{,expr}{,str2}{,ERR=lineref})

Description

For BBj-specific information, see the MSGBOX() Function - BBj.

The MSGBOX() function creates a message dialog box and returns a value that identifies the user-selected button.

Parameter

Description

str1

Dialog box message text. Lines are automatically broken at the right edge of the dialog box. To force a line break, insert a line-feed character ($0A$) before the first character of a line.

expr

Numeric expression that identifies the dialog's buttons, icons, default button, and modal setting.

The values are additive and can be expressed in one of two ways. For example, the following expression identifies the two ways to define a dialog has OK and Cancel buttons, and exclamation mark icon, the Cancel button is the default, and application modal settings:

(1+48+256+0)
305

 

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

 

Icon

0 None

16 Stop Sign

32 Question Mark

48 Exclamation Point

64 Information Symbol

 

Default Button

0 First button

256 Second button

512 Third button 

 

Modal Value

0 Application modal. Requires users to respond to the message box before continuing work in the current application.

262144 System modal. Requires users to respond to the message box before continuing work in any application. This value should only be set when immediately responding to a message takes priority over any other user activities.

str2

Dialog box title text. If this parameter is omitted, the program name is used as the title.

ERR=lineref

Branch to be taken if an error occurs during execution.

Returned Values

The value returned by MSGBOX() identifies which button the user selects, as follows:

Value

Button Selected

1

OK

2

Cancel

3

Abort

4

Retry

5

Ignore

6

Yes

7

No

Examples

Example 1

The following creates a dialog that displays "This is a message" and an OK button. In addition, it uses the program name as the dialog title and returns a value of 1:

let x=msgbox("This is a message")

Example 2

The following creates a dialog that displays the contents of MESSAGE$ as the message text; contains Cancel and Retry buttons and a question mark icon; and displays the contents of TITLE$ as the dialog title.

let x=msgbox(message$,5+32+256,title$)

Selecting the Cancel button (default) returns a value of 2. Selecting the Retry button returns a value of 4.

See Also

Functions - Alphabetical Listing




______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.