Difference between revisions of "MsgBox"
(copied parameters and description) |
(example) |
||
Line 1: | Line 1: | ||
[[category:User-interface functions]] | [[category:User-interface functions]] | ||
+ | |||
+ | [[image:MsgBoxExample.jpg]] | ||
= Declaration = | = Declaration = | ||
Line 8: | Line 10: | ||
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. | 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. | ||
+ | |||
+ | The title defaults to the title of the calling variable. | ||
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: | ||
Line 33: | Line 37: | ||
In ADE, MsgBox displays nothing and returns 0. | In ADE, MsgBox displays nothing and returns 0. | ||
+ | |||
+ | If a user presses Cancel, the current computation aborts. | ||
+ | |||
+ | = How values are displayed = | ||
+ | |||
+ | 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]) | ||
+ | |||
+ | = Uses = | ||
+ | |||
+ | MsgBox can be used to inform pass a message to the user during evaluation. | ||
+ | |||
+ | However, a more ubiquitous use is during model debugging, where MsgBox can serve as a convient tool for peeking at values while a complex algorithm is in progress. | ||
+ | |||
+ | = Example = | ||
+ | |||
+ | This example provides a peek at the result before returning it. | ||
+ | |||
+ | var v := Sales_revenue - Cost; | ||
+ | MsgBox(v); | ||
+ | v |
Revision as of 10:05, 9 February 2007
Declaration
MsgBox(message ; buttons:optional scalar ; title:optional text)
Description
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.
The title defaults to the title of the calling variable.
The optional <buttons> parameter can be used to control which buttons are displayed, as follows:
- 0 = OK only
- 1 = OK and Cancel
- 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.
How values are displayed
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])
Uses
MsgBox can be used to inform pass a message to the user during evaluation.
However, a more ubiquitous use is during model debugging, where MsgBox can serve as a convient tool for peeking at values while a complex algorithm is in progress.
Example
This example provides a peek at the result before returning it.
var v := Sales_revenue - Cost; MsgBox(v); v
Enable comment auto-refresher