Button types

By default only the Ok button (for the information message box), Retry and Abort buttons (for the warning message box) or Retry button (for the critical message box) will appear. To use other buttons, simply specify the buttons to appear in the command via the principle:

MessageBox.<type: information/warning/critical>( "text to appear", MessageBox.<button>, MessageBox.<anotherButton>);

For example:

function Retry_abort_ignore_message_box() {

 

var userResponse = MessageBox.information("An error occurred! What to do?", MessageBox.Abort, MessageBox.Retry, MessageBox.Ignore);

BrainVoyagerQX.PrintToLog("The response was: " + userResponse);

}

 

A message box can have the following buttons:

 

Button type

Response number

 

 

Ok

1

Cancel

2

Yes

3

No

4

Abort

5

Retry

6

Ignore

7

 

but the response of the user can simply be retrieved via:

 

if (userResponse == MessageBox.Yes) {

 

}

 

or asking the number:

 

if (userResponse == 3) {

 

}

 

or via the use of a constant:

 

const RESPONSE_YES = MessageBox.Yes;

 

if (userResponse == RESPONSE_YES) {

 

}