Creating Popup Messages
A popup message is a window that contains some text. Usually it informs the user of a condition—a warning or the confirmation of a choice, for instance—then is dismissed when the user clicks on the OK button. No other interaction is required.
 
Figure 5-23: Pop-up Message
The WwMessage function is used to create message windows.
 
note
Message windows are popup widgets. This means that they must have an intermediate widget, such as a button, as their parent. The popup widget appears after the user selects the intermediate button. See "Message Box Example" for more information.
Blocking vs. Nonblocking Windows
A message window can be blocking or nonblocking. Blocking means that no other user action can occur until the message or dialog is confirmed—user clicks on OK—or the message box is dismissed. The blocking window “blocks” the user from performing other actions as long as the window remains on the screen.
A nonblocking message window can remain on the screen while the user performs other actions. The nonblocking dialog or message does not “block” the user from performing other actions.
The WwMessage function has a Block and a Nonblock keyword. Use the Block keyword to create a blocking window and the Nonblock keyword to create a nonblocking window.
Types of Message Windows
You can create four types of message boxes. These types are available only with the Motif message widget. They are shown in Figure 5-24: Message Windows. Clockwise from upper-left: Information, Working, Question, and Warning.
*Information message—Specified with the Info keyword.
*Working message—Specified with the Working keyword.
*Warning message—Specified with the Warning keyword.
*Question message—Specified with the Question keyword.
 
Figure 5-24: Message Windows
Default Message Box Buttons
By default, three buttons appear along the bottom edge of message windows. They are used to confirm or cancel the message.
Motif Buttons
OK—Confirms the message.
Cancel—Cancels the message.
Help—Not supported.
Message Box Example
This example creates a row of buttons you can click on to display the four different types of Motif message boxes. To run the example, enter the callback procedures in a file and compile them with the .RUN command. Then enter the widget commands at the WAVE> prompt. The result is shown in Figure 5-23: Pop-up Message.
Callback Routines
PRO MessageOK, wid, data
print,'Message OK'
END
PRO MessageCancel, wid, data
print,'Message Cancel'
END
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
Widget Commands
top=WwInit('ww_ex14', 'Examples', layout)
button=WwButtonBox(layout, ['Information', $
'Working', 'Warning', 'Question'], 'MbuttonCB')
status=WwSetValue(top, /Display)
WwLoop