Messages examples

The following example show how messages can be used in an application.

Example 1

The following message has the indicated value.

[spacer]

Message ID

100

Message

You must enter your password.


The following script uses the getmsg() function to retrieve the message and the warning statement to display a warning for the user. The message “You must enter your password.” will be displayed in a warning dialog box.

local string Message;

{Retrieve the message using the message ID.}
Message = getmsg(100);
warning Message;

Example 2

Additional strings can be added to messages by inserting replacement markers in the message indicating where the items will be substituted. A replacement marker is a percent symbol (%) followed by a number.

The following message has the indicated value.

[spacer]

Message ID

101

Message

The module %1 could not be
opened because %2.


The following script uses the getmsg() statement to retrieve the message. The substitute statement substitutes the two text items for the replacement markers within the message. The error statement displays the message “The module Inventory could not be opened because you don’t have access privileges.” in an error dialog.

local string Message;

{Retrieve the message using the ID for the desired message.}
Message = getmsg(101);
{Substitute the items for replacement markers in the message.} 
substitute Message, "Inventory", "you don’t have access privileges";
error Message;

Documentation Feedback