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,

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.