Page History
&<img src="../resources/images/opentocr.png" title="Open Contents list" border="0"&>
You are here:
...
A message box is displayed on top of the current form. A message box is modal, in other words the user has to click one of the buttons in the message box to dismiss it before the underlying form is reactivated.
The message box consists of a title, an icon, message text and one or more command buttons as shown:
Message boxes are created using the MESSAGE_BOX_SHOW Built-In Function. Here is the source for the message box shown above:
use builtin(MESSAGE_BOX_SHOW) with_args(OK OK Information 'Radio Button' 'Radio button 2 has been selected')
The MESSAGE_BOX_SHOW function has the following arguments:
Argument | Description | Possible Values |
|---|---|---|
Enable Buttons | The buttons shown in the message box. | YesNo |
Default Button | The button that has the focus. | Any of the buttons in the Enable Buttons argument. |
Icon to Show | The icon shown in the message box. | Question (question mark icon) |
Title of Message Box |
The text for the title enclosed in single quotes | ||
Text to Show |
The message text enclosed in single quotes |
|
This code:
use builtin(MESSAGE_BOX_SHOW) with_args(YesNo No Question 'Confirmation' 'Do you want to proceed with the operation?')
Creates and displays a message box with two buttons, Yes and No. No is the default button. The icon is a question mark as shown here:
Getting the User's Response
When your message box has more than one button, you need to know which one the user has clicked. To get the response, use the TO_GET parameter and specify a field where you want the response stored. The field must be an alpha field of 20 characters or less.
To store the response to the Confirmation dialog box in a field named #REPLY, you would specify:
use builtin(MESSAGE_BOX_SHOW) with_args(YesNo No Question 'Confirmation' 'Do you want to proceed with the operation?') to_get(#reply)
You could then use the value of #REPLY to determine what action the program should take. For instance:
If cond'#reply *EQ Yes'
use builtin(MESSAGE_BOX_SHOW) with_args(OK OK Information '' 'Yes was
pressed')
else
use builtin(MESSAGE_BOX_SHOW) with_args(OK OK Information '' 'No was
pressed')
endif
Depending on what buttons the message box has, the return value can be:
...