Next | Prev | Up | Top | Contents | Index

xmMessageBox

Message boxes are used to display simple messages. The xmMessageBox widget can also display a pixmap symbol to indicate warnings or error conditions. This is done by setting the -dialogType resource, or by specifying a pixmap with -symbolPixmap.

This example shows the use of an xmMessageBox with custom pixmap face, which is taken from an external file:

#! /usr/sgitcl/bin/moat 
xtAppInitialize
xmMessageBox .top managed \
    -messageString {Hello world!} \
    -symbolPixmap /usr/share/src/sgitcl/face
. realizeWidget
. mainLoop

Figure 4-13 : xmMessageBox With Pixmap A message box is a composite widget whose component children might be managed or unmanaged. Child widgets can be included or eliminated using the Tcl Motif commands manageChild and unmanageChild applied on the automatically-derived child widgets. With a message box named mw, these are the standard child widgets:

    mw.Cancel    mw.Help        mw.Message
    mw.OK        mw.Separator   mw.Symbol
This example is like the xmMessageBox above, but without the Cancel and Help buttons and the separator line:

#! /usr/sgitcl/bin/moat 
xtAppInitialize
xmMessageBox .mb managed -messageString {Hello world!} \
    -symbolPixmap /usr/share/src/sgitcl/face
foreach child {Cancel Help Separator} {
   .mb.$child unmanageChild
}
. realizeWidget
. mainLoop
Table 4-52 lists the resources associated with xmMessageBox.

xmMessageBox Resources
Resource NameDefault ValueType or Legal Values
-cancelLabelString"Cancel" String
-defaultButtonTypedialog_ok_buttondialog_cancel_button
dialog_help_button
dialog_ok_button
-dialogTypedialog_messagedialog_error
dialog_information
dialog_message
dialog_question
dialog_warning
dialog_working
-helpLabelString"Help"String
-messageAlignmentalignment_beginningalignment_center
alignment_beginning
alignment_end
-messageString""String
-minimizeButtons FalseBoolean
-okLabelString"OK"String
-symbolPixmap depends on -dialogTypePixmap

Table 4-53 lists the callbacks associated with xmMessageBox.

xmMessageBox Callbacks
Method Name Why
cancelCallback The cancel button was activated.
helpCallback The help button was activated, or a Help action arose.
okCallback The OK button was activated.
focusCallback The window gained input focus.
mapCallback The window was mapped on screen.
unmapCallback The window was unmapped.

Furthermore, xmMessageBox also inherits destroyCallback from the Core class.


Next | Prev | Up | Top | Contents | Index