GUI Message Boxes


The MESSAGE command tells DADiSP to display a message box that is a standard format in the appropriate GUI (MS-Windows or Motif). These messages are very effective ways to display information to the user during the execution of a command file and to query the user for confirmation of command file actions. The format of the MESSAGE function includes a label, the message text, the choice of OK, CANCEL, YES, and NO buttons, in a variety of combinations, and the choice of icon which will appear in the message box (question mark, exclamation point, I for information, or stop sign). See the DADiSP Function Reference Manual for detailed information on the MESSAGE function.


When a message box is displayed, execution of command file halts until the user clicks on a button in the message box to clear the message. No pause via @PAUSE, @WAIT, or @WAITKEY is necessary when using the MESSAGE function to display messages. A value of 1, 0, or -1 is returned based upon the user’s selection (1 = Yes, 0 = No or Cancel, -1 = Cancel); the return values are useful for command file branching. Message boxes cannot be resized.


Message boxes appear in the center of the application window, however, the user is able to move them anywhere within the application window. This is a particularly useful feature if you want the user to examine the contents of one or more windows before clearing the message.


Finally, one major advantage of using the MESSAGE command to display messages during a command file is that the text does not need to be fixed in the command file. That is, the string used for the message can be a DADiSP expression which is evaluated while the command file is running and displayed. For example, the following statement determines the appropriate Window number, and uses that in the message:


MESSAGE("Note",strcat("The data in W", strnum(getwnum),"contains no outliers."),3)


The following command file demonstrates some message box options:


! Message.dsp


MESSAGE("Message Demo","This demonstrates the MESSAGE function.",3) @CR

MESSAGE("Warning", "Value out of Range. Continue?",7) @CR


! To make a mult-line message, use the STRESCAPE function

! and the escape sequence


MESSAGE("Multi-line", strescape("Line 1. Line 3. Line 4."),3) @CR

Grandom(100,.01) @CR

MESSAGE("Stats", STRCAT("Mean: ", STRNUM(mean)," Std. Dev: ", STRNUM(stdev)),3) @CR