MSGBOX(str1{,expr}{,str2}{,ERR=lineref})
For BBj-specific information, see the MSGBOX() Function.
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. (1+48+256+0) |
|
|
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. |
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 |
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")
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.