Difference between revisions of "MsgBox"

Line 2: Line 2:
 
[[Category:Doc Status C]] <!-- For Lumina use, do not change -->
 
[[Category:Doc Status C]] <!-- For Lumina use, do not change -->
 
   
 
   
When it evaluates MsgBox(msg), it shows a modal dialog box with the message msg.
+
__TOC__
It pauses evaluation until you press a button. If you press '''Cancel''', it stops further
 
computation. By default, the title of the dialog is the identifier of the Variable (or Function)
 
that calls MsgBox(), and it shows buttons '''OK''' and '''Cancel'''.
 
  
[[image:MsgBoxExample.jpg]]
+
==MsgBox(msg, ''buttons, title'')==
 +
[[MsgBox]] displays a standard popup modal dialog box with a user-supplied message «msg» when it is evaluated.  It pauses evaluation until the user presses a button on the message box.  If the user presses '''Cancel''', it stops further computation.
  
= Declaration =
+
By default, the message box will show buttons '''OK''' and '''Cancel''', and title of the dialog is the identifier of the Variable (or Function) that calls [[MsgBox]]().
  
MsgBox(message ; buttons:optional scalar ; title:optional text)
+
You can use [[MsgBox]] to show the model user a message, warning, or error during evaluation. A common use is for model debugging to show intermediate values while a complex algorithm is in progress.
  
= Description =
+
===Declaration===
 +
:MsgBox(message ; buttons: optional scalar; title: optional text)
  
MsgBox displays a standard popup modal dialog with a user-supplied message when it is evaluated. Evaluation ceases until the user presses a button on the message box.
+
===Example===
 +
:<code>Variable Profit := Array(Time, [-121.1M, -75.33M, -12.41M, 62.06M, 62.06M, 1.594M, -58.87M, -119.3M])</code>
 +
:<code>MsgBox(Profit) &rarr;</code>
 +
:[[image:MsgBoxExample.jpg]]
  
The title defaults to the title of the calling variable.
+
==Optional parameters==
 
+
===Buttons===
The optional <buttons> parameter can be used to control which buttons are displayed, as follows:
+
The optional «buttons» parameter can be used to control which buttons are displayed, as follows:
* 0 = OK only
+
* <code>0</code> = '''OK''' only
* 1 = OK and Cancel [Default]
+
* <code>1</code> = '''OK''' and '''Cancel''' [Default]
* 2 = Abort, Retry and Ignore
+
* <code>2</code> = '''Abort''', '''Retry''' and '''Ignore'''
* 3 = Yes, No and Cancel
+
* <code>3</code> = '''Yes''', '''No''' and '''Cancel'''
* 4 = Yes and No
+
* <code>4</code> = '''Yes''' and '''No'''
* 5 = Retry and Cancel
+
* <code>5</code> = '''Retry''' and '''Cancel'''
  
 
The icon can also be changed by adding the following to the buttons parameter:
 
The icon can also be changed by adding the following to the buttons parameter:
* 16 = Critical
+
* <code>16</code> = Critical
* 32 = Question
+
* <code>32</code> = Question
* 48 = Exclamation
+
* <code>48</code> = Exclamation
* 64 = Information
+
* <code>64</code> = Information
  
 
The return value indicates which button was pressed, as follows:
 
The return value indicates which button was pressed, as follows:
* 1 = OK
+
* <code>1</code> = '''OK'''
* 2 = Cancel
+
* <code>2</code> = '''Cancel'''
* 3 = Abort
+
* <code>3</code> = '''Abort'''
* 4 = Retry
+
* <code>4</code> = '''Retry'''
* 5 = Ignore
+
* <code>5</code> = '''Ignore'''
* 6 = Yes
+
* <code>6</code> = '''Yes'''
* 7 = No
+
* <code>7</code> = '''No'''
 
 
In ADE, MsgBox displays nothing and returns 0.
 
  
If a user presses Cancel, the current computation aborts.
+
In [[ADE]], [[MsgBox]] displays nothing and returns <code>0</code>.
  
= How values are displayed =
+
If a user presses '''Cancel''', the current computation aborts.
  
MsgBox does not array abstract over its first parameter. Instead, it attempts to display the entire parameter using the current [[tableType]] system variable format with the number format of the variable containing the call.  Atomic text strings or numbers appear as such, but arrays appear in a format such as:
+
===Title===
Array( Time, [-121.1M,-75.33M,-12.41M,62.06M,62.06M,1.594M,-58.87M,-119.3M])
+
The optional «title» parameter can be used to provide a title for the message box . If no title is specified, the title defaults to the title of the calling variable or function.
  
= Uses =
+
== Details and more examples ==
  
You can use MsgBox to show the model user a message, warning, or error during evaluation. A common use is for
+
[[MsgBox]] does not [[Array abstraction|array abstract]] over its first parameter.  Instead, it attempts to display the entire parameter using the current [[tableType]] system variable format with the number format of the variable containing the call.  Atomic text strings or numbers appear as such, but arrays appear in a format such as:
model debugging to show intermediate values while a complex algorithm is in progress.
+
:<code>Array(Time, [-121.1M, -75.33M, -12.41M, 62.06M, 62.06M, 1.594M, -58.87M, -119.3M])</code>
  
= Example =
 
  
This example provides a peek at the result before returning it.
+
'''Example:''' This example provides a peek at the result before returning it.
 +
:<code>var v := Sales_revenue - Cost;</code>
 +
:<code>MsgBox(v);</code>
 +
:<code>v</code>
  
var v := Sales_revenue - Cost;
+
==See Also==
MsgBox(v);
+
* [[Buttons]]
v
 

Revision as of 21:00, 12 January 2016


MsgBox(msg, buttons, title)

MsgBox displays a standard popup modal dialog box with a user-supplied message «msg» when it is evaluated. It pauses evaluation until the user presses a button on the message box. If the user presses Cancel, it stops further computation.

By default, the message box will show buttons OK and Cancel, and title of the dialog is the identifier of the Variable (or Function) that calls MsgBox().

You can use MsgBox to show the model user a message, warning, or error during evaluation. A common use is for model debugging to show intermediate values while a complex algorithm is in progress.

Declaration

MsgBox(message ; buttons: optional scalar; title: optional text)

Example

Variable Profit := Array(Time, [-121.1M, -75.33M, -12.41M, 62.06M, 62.06M, 1.594M, -58.87M, -119.3M])
MsgBox(Profit) →
MsgBoxExample.jpg

Optional parameters

Buttons

The optional «buttons» parameter can be used to control which buttons are displayed, as follows:

  • 0 = OK only
  • 1 = OK and Cancel [Default]
  • 2 = Abort, Retry and Ignore
  • 3 = Yes, No and Cancel
  • 4 = Yes and No
  • 5 = Retry and Cancel

The icon can also be changed by adding the following to the buttons parameter:

  • 16 = Critical
  • 32 = Question
  • 48 = Exclamation
  • 64 = Information

The return value indicates which button was pressed, as follows:

  • 1 = OK
  • 2 = Cancel
  • 3 = Abort
  • 4 = Retry
  • 5 = Ignore
  • 6 = Yes
  • 7 = No

In ADE, MsgBox displays nothing and returns 0.

If a user presses Cancel, the current computation aborts.

Title

The optional «title» parameter can be used to provide a title for the message box . If no title is specified, the title defaults to the title of the calling variable or function.

Details and more examples

MsgBox does not array abstract over its first parameter. Instead, it attempts to display the entire parameter using the current tableType system variable format with the number format of the variable containing the call. Atomic text strings or numbers appear as such, but arrays appear in a format such as:

Array(Time, [-121.1M, -75.33M, -12.41M, 62.06M, 62.06M, 1.594M, -58.87M, -119.3M])


Example: This example provides a peek at the result before returning it.

var v := Sales_revenue - Cost;
MsgBox(v);
v

See Also

Comments


You are not allowed to post comments.