Several statements and functions allow you to communicate with the user. The following are some of the methods you can use.
The warning and error statements produce a dialog box that displays a message for the user. This script produces the error dialog shown in the following illustration.
error "This customer number is invalid.";
You may want to display multiple lines within a dialog box. To have a multi-line message where you control the line breaks, you need to use a local text field as the source of the message text. When a text value is displayed in a dialog box, Dexterity will automatically add a scroll bar and allow multiple lines to be displayed. You can use the char() statement to indicate a new line.
The following example shows how to create a multi-line message. It produces the dialog shown in the following illustration.
local text message; message = "First line" + char(13) + "Second line"; warning message;
The ask() function creates a dialog box that contains a message and up to three buttons. (It can have a fourth button labeled Help, if you implement online help for your application). The ask() function returns an integer value that indicates which button was clicked by the user. This script produces the ask dialog shown in the following illustration.
local integer answer; answer = ask("Delete this item?","Yes","No","Cancel");
If the value of the local variable answer is 1, then the user clicked Yes. If the value is 2, the user clicked No, and if it’s 3, the user clicked Cancel. You can use the ASKBUTTON constants when examining the return value.