Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Composite(3Xm)

Constraint(3Xm)

Core(3Xm)

XmBulletinBoard(3Xm)

XmCreateErrorDialog(3Xm)

XmCreateInformationDialog(3Xm)

XmCreateMessageBox(3Xm)

XmCreateMessageDialog(3Xm)

XmCreateQuestionDialog(3Xm)

XmCreateWarningDialog(3Xm)

XmCreateWorkingDialog(3Xm)

XmManager(3Xm)

XmMessageBoxGetChild(3Xm)

XmMessageBox(3Xm)  —  UNIX Programmer’s Manual

NAME

XmMessageBox — the MessageBox widget class. 

SYNOPSIS

#include <Xm/MessageB.h>

DESCRIPTION

MessageBox is a dialog class used for creating simple message dialogs.  Convenience dialogs based on MessageBox are provided for several common interaction tasks, which include giving information, asking questions, and reporting errors. 

A MessageBox dialog is typically transient in nature, displayed for the duration of a single interaction.  MessageBox is a subclass of XmBulletinBoard and depends on it for much of its general dialog behavior. 

A MessageBox can contain a message symbol, a message, and up to three standard default PushButtons:  OK, Cancel, and Help.  It is laid out with the symbol in the top left, the message in the top and center-to-right side, and the PushButtons on the bottom.  The help button is positioned to the far right of the other PushButtons.  Default symbols and button labels for MessageBox convenience dialogs are localizable. 

Button label defaults are easily modified by including the new values in any of the app-defaults file locations supported by Xt Intrinsics.  Changing the defaults for MessageBox symbols is more complicated, since the Xt Intrinsics do not support specification of pixmaps by name in resource files. 

At initialization, MessageBox looks for the following bitmap files:

•xm_error

•xm_information

•xm_question

•xm_working

•xm_warning

See XmGetPixmap(3Xm) for a description of what paths are searched for these files. 

Classes

MessageBox inherits behavior and resources from Core, Composite, Constraint, XmManager, and XmBulletinBoard. 

The class pointer is xmMessageBoxWidgetClass. 

The class name is XmMessageBox. 

New Resources

The following table defines a set of widget resources used by the programmer to specify data.  The programmer can also set the resource values for the inherited classes to set attributes for this widget.  To reference a resource by name or by class in a .Xdefaults file, remove the XmN or XmC prefix and use the remaining letters.  To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm prefix and use the remaining letters (in either lower case or upper case, but include any underscores between words).  The codes in the access column indicate if the given resource can be set at creation time (C), set by using XtSetValues (S), retrieved by using XtGetValues (G), or is not applicable (N/A). 

XmMessageBox Resource Set
Name Class Type Default Access
XmNcancelCallback XtCallbackList XtCallbackList NULL C
XmNcancelLabelString XmCXmString XmString "Cancel" CSG
XmNdefaultButtonType XmCDefaultButtonType unsigned char XmDIALOG_OK_BUTTON CSG
XmNdialogType XmCDialogType unsigned char XmDIALOG_MESSAGE CSG
XmNhelpLabelString XmCXmString XmString "Help" CSG
XmNmessageAlignment XmCAlignment unsigned char XmALIGNMENT_BEGINNING CSG
XmNmessageString XmCXmString XmString NULL CSG
XmNminimizeButtons XmCMinimizeButtons Boolean False CSG
XmNokCallback XtCallbackList XtCallbackList NULL C
XmNokLabelString XmCXmString XmString "OK" CSG
XmNsymbolPixmap XmCPixmap Pixmap dynamic CSG

XmNcancelCallback
Specifies the list of callbacks that is called when the user clicks on the cancel button. The reason sent by the callback is XmCR_CANCEL. 

XmNcancelLabelString
Specifies the string label for the cancel button.

XmNdefaultButtonType
Specifies the default PushButton.  The following are valid types:

•XmDIALOG_CANCEL_BUTTON. 

•XmDIALOG_OK_BUTTON. 

•XmDIALOG_HELP_BUTTON. 

XmNdialogType
Specifies the type of MessageBox dialog, which determines the default message symbol. The following are the possible values for this resource:

•XmDIALOG_ERROR — indicates an ErrorDialog. 

•XmDIALOG_INFORMATION — indicates an InformationDialog. 

•XmDIALOG_MESSAGE — indicates a MessageDialog.  This is the default MessageBox dialog type.  The default message symbol is NULL. 

•XmDIALOG_QUESTION — indicates a QuestionDialog. 

•XmDIALOG_WARNING — indicates a WarningDialog. 

•XmDIALOG_WORKING — indicates a WorkingDialog. 

If this resource is changed via XtSetValues, the symbol bitmap will be modified to the new XmdialogType bitmap unless XmNsymbolPixmap is also being set in XtSetValues. 

XmNhelpLabelString
Specifies the string label for the help button.

XmNmessageAlignment
Controls the alignment of the message Label. Possible values include the following:

•XmALIGNMENT_BEGINNING — the default. 

•XmALIGNMENT_CENTER. 

•XmALIGNMENT_END. 

XmNmessageString
Specifies the string to be used as the message.

XmNminimizeButtons
Sets the buttons to the width of the widest button and height of the tallest button if False.  If True, button width and height are set to the preferred size of each button.

XmNokCallback
Specifies the list of callbacks that is called when the user clicks on the OK Button. The reason sent by the callback is XmCR_OK. 

XmNokLabelString
Specifies the string label for the OK button.

XmNsymbolPixmap
Specifies the pixmap label to be used as the message symbol.

Inherited Resources

MessageBox inherits behavior and resources from the following superclasses.  For a complete description of these resources, refer to the man page for that superclass. 

XmBulletinBoard Resource Set
Name Class Type Default Access
XmNallowOverlap XmCAllowOverlap Boolean True N/A
XmNautoUnmanage XmCAutoUnmanage Boolean True CSG
XmNbuttonFontList XmCButtonFontList XmFontList NULL CSG
XmNcancelButton XmCWidget Widget Cancel button G
XmNdefaultButton XmCWidget Widget OK button G
XmNdefaultPosition XmCDefaultPosition Boolean True CSG
XmNdialogStyle XmCDialogStyle unsigned char dynamic CSG
XmNdialogTitle XmCXmString XmString NULL CSG
XmNfocusCallback XmCCallback XtCallbackList NULL C
XmNlabelFontList XmCLabelFontList XmFontList NULL CSG
XmNmapCallback XmCCallback XtCallbackList NULL C
XmNmarginHeight XmCMarginHeight short 10 CSG
XmNmarginWidth XmCMarginWidth short 10 CSG
XmNnoResize XmCNoResize Boolean False CSG
XmNresizePolicy XmCResizePolicy unsigned char XmRESIZE_ANY CSG
XmNshadowType XmCShadowType unsigned char XmSHADOW_OUT CSG
XmNstringDirection XmCStringDirection XmStringDirection XmSTRING_DIRECTION_L_TO_R CSG
XmNtextFontList XmCTextFontList XmFontList NULL N/A
XmNtextTranslations XmCTranslations XtTranslations NULL N/A
XmNunmapCallback XmCCallback XtCallbackList NULL C

XmManager Resource Set
Name Class Type Default Access
XmNbottomShadowColor XmCForeground Pixel dynamic CSG
XmNbottomShadowPixmap XmCBottomShadowPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNforeground XmCForeground Pixel dynamic CSG
XmNhelpCallback XmCCallback XtCallbackList NULL C
XmNhighlightColor XmCForeground Pixel Black CSG
XmNhighlightPixmap XmCHighlightPixmap Pixmap dynamic CSG
XmNshadowThickness XmCShadowThickness short dynamic CSG
XmNtopShadowColor XmCBackground Pixel dynamic CSG
XmNtopShadowPixmap XmCTopShadowPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNunitType XmCUnitType unsigned char XmPIXELS CSG
XmNuserData XmCUserData caddr_t NULL CSG

Composite Resource Set
Name Class Type Default Access
XmNinsertPosition XmCInsertPosition XmRFunction NULL CSG

Core Resource Set
Name Class Type Default Access
XmNaccelerators XmCAccelerators XtTranslations NULL CSG
XmNancestorSensitive XmCSensitive Boolean True G
XmNbackground XmCBackground Pixel dynamic CSG
XmNbackgroundPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNborderColor XmCBorderColor Pixel Black CSG
XmNborderPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNborderWidth XmCBorderWidth Dimension 0 CSG
XmNcolormap XmCColormap Colormap XtCopyFromParent CG
XmNdepth XmCDepth int XtCopyFromParent CG
XmNdestroyCallback XmCCallback XtCallbackList NULL C
XmNheight XmCHeight Dimension 0 CSG
XmNmappedWhenManaged XmCMappedWhenManaged Boolean True CSG
XmNscreen XmCScreen Pointer XtCopyScreen CG
XmNsensitive XmCSensitive Boolean True CSG
XmNtranslations XmCTranslations XtTranslations NULL CSG
XmNwidth XmCWidth Dimension 0 CSG
XmNx XmCPosition Position 0 CSG
XmNy XmCPosition Position 0 CSG

Callback Information

The following structure is returned with each callback:

typedef struct
{
intreason;
XEvent∗ event;
} XmAnyCallbackStruct;

reasonIndicates why the callback was invoked. 

eventPoints to the XEvent that triggered the callback. 

Behavior

Following is a summary of the behavior of MessageBox. 

<Ok Button Activated>:
When the ok PushButton is activated, the callbacks for XmNokCallback are called. 

<Cancel Button Activated>:
When the cancel PushButton is activated, the callbacks for XmNcancelCallback are called. 

<Help Button Activated> or <Key>F1:
When the help button or Function key 1 is pressed, the callbacks for XmNhelpCallback are called. 

<Default Button Activated>:
When the default button is pressed, the activate callbacks of the default PushButton are called.

<FocusIn>:
When a FocusIn event is generated on the widget window, the callbacks for XmNfocusCallback are called. 

<MapWindow>:
When a MapWindow event is generated on the widget window, the callbacks for XmNmapCallback are called. 

<UnmapWindow>:
When a UnmapWindow event is generated on the widget window, the callbacks for XmNunmapCallback are called. 

Default Accelerators

The default accelerator translations added to descendants of a BulletinBoard if the parent of the BulletinBoard is a DialogShell are:

#override
<Key>F1:Help()
<Key>Return:Return()
<Key>KP_Enter: Return()

Keyboard Traversal

For information on keyboard traversal, see the man page for XmManager(3Xm) and its sections on behavior and default translations. 

RELATED INFORMATION

Composite(3Xm), Constraint(3Xm), Core(3Xm), XmBulletinBoard(3Xm), XmCreateErrorDialog(3Xm), XmCreateInformationDialog(3Xm), XmCreateMessageBox(3Xm), XmCreateMessageDialog(3Xm), XmCreateQuestionDialog(3Xm), XmCreateWarningDialog(3Xm), XmCreateWorkingDialog(3Xm), XmManager(3Xm), and XmMessageBoxGetChild(3Xm). 

7th Edition

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026