About Application Messages
About Application Messages
An application displays a variety of messages such as error messages, information messages, questions, and so on. Ensure the text of these messages is external to the application programs rather than imbedded directly in the application code. This facilitates changing the text.
The Framework supports application messages by providing external tables in which messages can be stored and by providing a program (pUserMessage) to output messages. Application message templates can contain flags indicating where parameters are to be substituted by the application at runtime.
This method offers several advantages:
- Many messages are used in more than one place. With the Framework, the message is defined once rather than being duplicated.
- Messages are easily modified. There is no need to search program code for specific messages.
- Application code is national language independent since messages are in the external tables rather than being embedded in the code.
- Application messages can be modified directly at a user’s location, eliminating the need to deploy an entirely new version of an application to update messages.
The Framework offers this support through EntitySets called ApplMessages and ApplMessTitles, standard entries in these EntitySets, and programs to produce messages (pUserMessage and pUserMsgParm). These EntitySets and programs are described briefly below and in more detail in the Reference Guide.
ApplMessages is an EntitySet defined in $DeployServices. Every Zim database has its own copy of ApplMessages. The fields of ApplMessages are ApplMessCode, ApplMessType, ApplMessStyle, ApplMessDefault, ApplMessage, ApplMessLang, and ApplMessOwner. The Framework uses the $ MessageBox function to produce messages and the fields of ApplMessages correspond closely to the parameters to that function.
ApplMessTitles is an EntitySet defined in $DeployServices. Every Zim database has its own copy of ApplMessTitles. The fields of ApplMessTitles are ApplMessOperation, ApplMessTitle, ApplMessTitleLang, and ApplMessTitleOwner. The Framework uses ApplMessTitles to control the window caption when displaying messages. Messages and message titles are flagged with a language code ( ApplMessLang for ApplMessages and ApplMessTitleLang for ApplMessTitles). A variable ($Language) can be set at runtime to indicate which language to use. Using this facility, application messages can be displayed in a variety of different languages.
Note: The actual filename for the copy of ApplMessTitles is Zim0128 and is located in a subdirectory of your database directory called DPSRT.
pUserMessage is used to display messages. By passing appropriate entries to pUserMessage, the application can override the message type, style, text, and default button.
pUserMsgParm is used to set message parameters to specific values. pUserMessage inserts these parameter values into the message where the message template (stored in ApplMessages) indicates.
STANDARD MESSAGES AND TITLES
A number of standard messages and message titles are provided with the Framework. See the Reference Guide for details.