613-518-1166 info@zimdatabases.com

ZIM Development Center (DC) for Zim 7

Application Messages

< All Topics

Application Messages

The $MessageBox function provides a convenient way to display messages and seek a response from the user.

Using $MessageBox Directly

Here is a typical use of $MessageBox:

let vlResponse = $MessageBox ( \
“This object already exists. Overwrite it?”, \
cWarningMsg, cYesNoStyle, 1, “New Object”)
if $toupper(vlResponse) = “YES”

One disadvantage of using $MessageBox is that the text of all messages is in the program code. As a result,

  • changing the text of messages requires that the program be edited and recompiled and that means application messages cannot be changed in the field;
  • if the text of all messages is to be changed (e.g. to switch an application to another natural language), all program code must be scanned for messages; and
  • if a message can be produced from more than one place in an application, the developer must ensure that all instances of the message are the same.

Using External Message Texts

These issues can be addressed by storing the message texts in an external table and using the pUserMessage Framework program. The example above could be replaced by

pUserMessage ( “New”, cEXISTS, “”, 0, 0, “”, vlResponse)
if $toupper(vlResponse) = “Yes”

Here “New” is a code string for the title we want in the message box and cEXISTS is a constant code that identifies the message we want. Both title and message text are looked up in external tables.

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?

Submit a Comment

Your email address will not be published. Required fields are marked *

Table of Contents