WwMessage Function

Creates a blocking or nonblocking message box.

Usage

wid = WwMessage(parent, [label,] OKCallback, CancelCallback, HelpCallback)

Input Parameters

parent — The widget ID of the parent widget.

label — (optional) A string containing the message text of the Dialog widget. If the label parameter is not defined or is a null string, the function looks for the message label in a resource specification (see Discussion).

OKCallback — A string containing the name of the callback routine that is called when the OK button is selected.

CancelCallback — A string containing the name of the callback routine that is executed when the Cancel button is selected.

HelpCallback — A string containing the name of the callback that is executed when the Help button is selected.

Returned Value

wid — The message box widget ID.

Keywords

Block — If present and nonzero, creates a blocking message box (the default).

Help — Use this keyword to specify a help topic when the HelpCallback parameter is not specified. This keyword can specify a two-element or one-element string array. If it is a two-element array, the first element is the name of a help topic and the second is the filename of the help file containing the topic. A one-element array specifies only the name of a help topic. In this case the default help file is used. For information on the location of the default help file, refer to the HELP command. The specified help topic is displayed in the online help viewer when the Help button is pressed.

Icon_file — A string containing either the full pathname or the filename of the icon file. If the icon file is not found, then the warning message, "Unable to find specified icon file: filename, using default icon file." appears.

Note:

The default icon definition is based on Windows vs. Motif as the window manager. On Windows, the default becomes the parent icon definition or the system icon if no parent has defined a unique window icon. On Motif, the default becomes the icon defined by !WIDGET_ICON.

Info — If present and nonzero, creates an information message box.

Name — String specifying the name of Dialog widget. The Name specified is the top-level widget name used in the resource specification. The keyword Name can be used the label parameter, although label (if other than a null string) will take precedence if both are given. (Default: message.)

Nonblock — If present and nonzero, creates a nonblocking message box. (This keyword has no effect under Microsoft Windows.)

NoSystemMenu — (Windows only) Causes the dialog to be displayed without the system menu and associated buttons (maximize, minimize, and close) on it's title bar. This keyword has no effect under UNIX.

Question — If present and nonzero, creates a question message box.

Title — Specifies a string containing the message box title.

Warning — If present and nonzero, creates a warning message box.

Working — If present and nonzero, creates a working message box.

Color/Font Keywords

Background — Specifies the background color name.

Font — Specifies the name of the font used for message text.

MSFont — Adds support for Windows fonts.

Foreground — Specifies the foreground color name.

Get/Set Value

Not supported.

Callback Parameters

Any message box callback procedure must have the following two parameters:

wid — Message widget ID.

shell — Shell widget ID.

Discussion

A message window is a popup window. This means that it cannot be the child of the top-level shell or the layout widget. Usually, a message widget is activated by a pushbutton or menu button, as in the example below.

Part of the message text resource specification can be specified using the Name keyword, otherwise the default is the *message.messageString resource (where messageString is the attribute).

Note:

The label parameter provides a method for “hard-coding” the message text in the application. For greater flexibility, create your resource file containing the message text using a text editor, and load the resource using WtResource. The Name keyword can then be used in the WwMessage calling sequence to specify the Dialog widget name in the resource specification.

Example 1

This example creates a button box with four buttons. If you are running under Motif, each button activates one of the four types of message windows: information, working, warning, or question. The callback MessageOK is executed when the user clicks on the OK or Confirm button. The callback MessageCancel is executed when the user clicks on the Cancel button.

Enter the callback procedures into a file, and compile them with the .RUN command. Then, enter the widget commands at the WAVE> prompt. To dismiss the widgets, select the appropriate function (such as Close) from the window manager menu of the menu bar.

Callback Procedures

PRO MbuttonCB, wid, data
   CASE data OF
      1: message=WwMessage(wid, $
         'This is a Test Message','MessageOK', $
         'MessageCancel',Title='Information')
      2: message=WwMessage(wid, $
         'This is a Test Message','MessageOK', $
         'MessageCancel', /Working, Title='Working')
      3: message=WwMessage(wid, $
         'This is a Test Message','MessageOK', $
         'MessageCancel', /Warning, $
         Title='Warning')
      4: message=WwMessage(wid, $
         'This is a Test Message','MessageOK', $
         'MessageCancel', /Question, Title='Question')
   ENDCASE
END
   PRO MessageOK, wid, data
   PRINT,'Message OK'
END
PRO MessageCancel, wid, data
   PRINT,'Message Cancel'
END

Widget Commands

top = WwInit('ww_ex30', 'Examples', layout)
button = WwButtonBox(layout, ['Information', $
   'Working', 'Warning', 'Question'], 'MbuttonCB')
status = WwSetValue(top, /Display)
WwLoop

Example 2

A typical resource specification for dialog text used in WwMessage is:

myapp.message.messageString: This is my message.

See Also

For detailed information on GUI development, refer to the PV‑WAVE Application Developer’s Guide.

For more information about how to write an application program based on PV‑WAVE Widgets, refer to Using Wave Widgets in the PV‑WAVE Application Developer’s Guide.

For additional information on the color and font keywords, see "Setting Colors and Fonts" in the PV‑WAVE Application Developer’s Guide.