Event.Form.MessageBox(Message)
Event.Form.MessageBox(Message) displays a DEACOM prompt at the end of the script execution. This is one of two ways to display information in a prompt for the user to see. The prompts for message boxes are stacked one on top of the other and displayed at the end of scripting execution. If you have multiple .MessageBox(Message) calls in a script, the user will see the last prompt first and as they clear the prompt move back to the first.
The .MessageBox(Message) is passive, while the .YesNo(Message) stops scripting execution to wait for a response from the user and returns a boolean to the script based on the response.
Note: The Event.Form.MessageBox(Message) does not always work correctly on the Open or Record Load form events. You have options around this:
-
If you are in 17.00.007 or newer, you can use the Enter form variable
-
If you are in older versions you can use the Reload event on the main grid
-
Please see the example below as there are considerations to make sure this message box only fires on opening the form.
Applies To
Properties and Methods
None
Available
The .MessageBox(Message) method is available in:
- 15.03.016
- All newer builds
Note: The .MessageBox(Message) method and all sub-classes, properties, and methods are only available in Form Layout scripts.
Type
Method
Syntax
Event.Form.MessageBox(Message);
Parameters
|
Parameter |
Required |
Description |
|---|---|---|
|
Message |
Yes |
The message displayed on the screen for the user to see |
Example
//--Add this script to a user-defined toolbar button's click event.
var lcMsg = 'Hello World!';
var lcMsg2 = 'Good day to you!';
Event.Form.MessageBox(lcMsg);
Event.Form.MessageBox(lcMsg2);
/* Expected Prompt response:
Good day to you!
Click OK. New expected response:
Hello World!
NOTE: the messages appear on screen from last to first because they are stacked one on top of the other when generated.
*/