XmMessageBox(Xm) 6 January 1993 XmMessageBox(Xm) Name XmMessageBox - the MessageBox widget class Syntax #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 XmBul- letinBoard and depends on it for much of its general dialog behavior. The default value for XmNinitialFocus is the value of XmNdefaultButton. A typical MessageBox contains a message symbol, a message, and up to three standard default PushButtons: OK, Cancel, and Help. It is laid out with the symbol and message on top and the PushButtons on the bottom. The help button is positioned to the side of the other push buttons. You can localize the default symbols and button labels for MessageBox convenience dialogs. The user can specify resources in a resource file for the gadgets created automatically that contain the MessageBox symbol pixmap and separator. The gadget names are Symbol and Separator. A MessageBox can also be customized by creating and managing new children that are added to the MessageBox children created automatically by the convenience dialogs. In the case of TemplateDialog, only the separator child is created by default. If the callback, string, or pixmap symbol resources are specified, the appropriate child will be created. Additional children are laid out in the following manner: + The first MenuBar child is placed at the top of the window. + All XmPushButton widgets or gadgets, and their subclasses are placed after the OK button in the order of their creation. + A child that is not in the above categories is placed above the row of buttons. If a message label exists, the child is placed below the label. If a message pixmap exists, but a message label is absent, the child is placed on the same row as the pixmap. The child behaves as a work area and grows or shrinks to fill the space above the row of but- tons. The layout of multiple work area children is undefined. At initialization, MessageBox looks for the following bitmap files: xm_error xm_information xm_question xm_working xm_warning See XmGetPixmap(Xm) for a list of the paths that are searched for these files. Classes MessageBox inherits behavior and resources from Core, Composite, Con- straint, 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 pro- grammer 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 lowercase or uppercase, 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 XmCCallback XtCallbackListNULL C XmNcancelLabel- XmCCancelLabel- XmString dynamic CSG String String XmNdefaultButton- XmCDefaultButton- unsigned char XmDIALOG- Type Type _OK_BUTTON XmNdialogType XmCDialogType unsigned char XmDIALOG_MESSAGECSG XmNhelpLabelStringXmCHelpLabelStringXmString dynamic CSG XmNmessage- XmCAlignment unsigned char XmALIGNMENT- Alignment _BEGINNING XmNmessageString XmCMessageString XmString "" CSG XmNminimizeButtonsXmCMinimizeButtonsBoolean False CSG XmNokCallback XmCCallback XtCallbackListNULL C XmNokLabelString XmCOkLabelString XmString dynamic 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 XmCRCANCEL. XmNcancelLabelString Specifies the string label for the cancel button. The default for this resource depends on the locale. In the C locale the default is Cancel. XmNdefaultButtonType Specifies the default PushButton. A value of XmDIALOGNONE means that there should be no default PushButton. The following are valid types: + XmDIALOGCANCELBUTTON + XmDIALOGOKBUTTON + XmDIALOGHELPBUTTON + XmDIALOGNONE XmNdialogType Specifies the type of MessageBox dialog, which determines the default message symbol. The following are the possible values for this resource: + XmDIALOGERROR -- indicates an ErrorDialog + XmDIALOGINFORMATION -- indicates an InformationDialog + XmDIALOGMESSAGE -- indicates a MessageDialog. This is the default MessageBox dialog type. It does not have an associ- ated message symbol. + XmDIALOGQUESTION -- indicates a QuestionDialog + XmDIALOGTEMPLATE -- indicates a TemplateDialog. The Templa- teDialog contains only a separator child. It does not have an associated message symbol. + XmDIALOGWARNING -- indicates a WarningDialog + XmDIALOGWORKING -- indicates a WorkingDialog If this resource is changed via XtSetValues, the symbol bitmap is modified to the new XmNdialogType bitmap unless XmNsymbolPixmap is also being set in the call to XtSetValues. If the dialog type does not have an associated message symbol, then no bitmap will be displayed. XmNhelpLabelString Specifies the string label for the Help button. The default for this resource depends on the locale. In the C locale the default is ``Help''. XmNmessageAlignment Controls the alignment of the message Label. Possible values include the following: + XmALIGNMENTBEGINNING -- the default + XmALIGNMENTCENTER + XmALIGNMENTEND 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 XmCROK. XmNokLabelString Specifies the string label for the OK button. The default for this resource depends on the locale. In the C locale the default is ``OK''. XmNsymbolPixmap Specifies the pixmap label to be used as the message symbol. Inherited resources MessageBox inherits behavior and resources from the following superc- lasses. For a complete description of each resource, refer to the man page for that superclass. XmBulletinBoard resource set ____________________________________________________________________________ Name Class Type Default Access ____________________________________________________________________________ XmNallowOverlap XmCAllowOverlap Boolean True CSG XmNautoUnmanage XmCAutoUnmanage Boolean True CG XmNbuttonFontList XmCButtonFontList XmFontList dynamic CSG XmNcancelButton XmCWidget Widget Cancel button SG XmNdefaultButton XmCWidget Widget dynamic SG XmNdefaultPosition XmCDefaultPosition Boolean True CSG XmNdialogStyle XmCDialogStyle unsigned char dynamic CSG XmNdialogTitle XmCDialogTitle XmString NULL CSG XmNfocusCallback XmCCallback XtCallbackList NULL C XmNlabelFontList XmCLabelFontList XmFontList dynamic CSG XmNmapCallback XmCCallback XtCallbackList NULL C XmNmarginHeight XmCMarginHeight Dimension 10 CSG XmNmarginWidth XmCMarginWidth Dimension 10 CSG XmNnoResize XmCNoResize Boolean False CSG XmNresizePolicy XmCResizePolicy unsigned char XmRESIZE_ANY CSG XmNshadowType XmCShadowType unsigned char XmSHADOW_OUT CSG XmNtextFontList XmCTextFontList XmFontList dynamic CSG XmNtext- XmCTranslations XtTranslations NULL C Translations XmNunmapCallback XmCCallback XtCallbackList NULL C XmManager resource set ____________________________________________________________________________ Name Class Type Default Access ____________________________________________________________________________ XmNbottom- XmCBottom- Pixel dynamic CSG ShadowColor ShadowColor XmNbottom- XmCBottom- Pixmap XmUNSPEC- CSG ShadowPixmap ShadowPixmap IFIED_PIXMAP XmNforeground XmCForeground Pixel dynamic CSG XmNhelpCallback XmCCallback XtCallbackList NULL C XmNhighlightColor XmCHighlightColor Pixel dynamic CSG XmNhighlightPixmap XmCHighlightPixmap Pixmap dynamic CSG XmNinitialFocus XmCInitialFocus Widget dynamic CSG XmNnavigationType XmCNavigationType XmNavigationType XmTAB_GROUP CSG XmNshadowThickness XmCShadowThickness Dimension dynamic CSG XmNstringDirection XmCStringDirection XmStringDirection dynamic CG XmNtopShadowColor XmCTopShadowColor Pixel dynamic CSG XmNtopShadowPixmap XmCTopShadowPixmap Pixmap dynamic CSG XmNtraversalOn XmCTraversalOn Boolean True CSG XmNunitType XmCUnitType unsigned char dynamic CSG XmNuserData XmCUserData XtPointer NULL CSG Composite resource set ____________________________________________________________________________ Name Class Type Default Access ____________________________________________________________________________ XmNchildren XmCReadOnly WidgetList NULL G XmNinsertPosition XmCInsertPosition XtOrderProc NULL CSG XmNnumChildren XmCReadOnly Cardinal 0 G Core resource set ____________________________________________________________________________ Name Class Type Default Access ____________________________________________________________________________ XmNaccelerators XmCAccelerators XtAccelerators dynamic N/A XmNancestor- XmCSensitive Boolean dynamic G Sensitive XmNbackground XmCBackground Pixel dynamic CSG XmNbackground- XmCPixmap Pixmap XmUNSPEC- CSG Pixmap IFIED_PIXMAP XmNborderColor XmCBorderColor Pixel XtDefault- CSG Foreground XmNborderPixmap XmCPixmap Pixmap XmUNSPEC- CSG IFIED_PIXMAP XmNborderWidth XmCBorderWidth Dimension 0 CSG XmNcolormap XmCColormap Colormap dynamic CG XmNdepth XmCDepth int dynamic CG XmNdestroyCallback XmCCallback XtCallbackList NULL C XmNheight XmCHeight Dimension dynamic CSG XmNinitial- XmCInitial- Boolean True C Resources- Resources- Persistent Persistent XmNmapped- XmCMapped- Boolean True CSG WhenManaged WhenManaged XmNscreen XmCScreen Screen * dynamic CG XmNsensitive XmCSensitive Boolean True CSG XmNtranslations XmCTranslations XtTranslations dynamic CSG XmNwidth XmCWidth Dimension dynamic CSG XmNx XmCPosition Position 0 CSG XmNy XmCPosition Position 0 CSG Callback information A pointer to the following structure is passed to each callback: typedef struct { int reason; XEvent * event; } XmAnyCallbackStruct; reason Indicates why the callback was invoked event Points to the XEvent that triggered the callback Translations XmMessageBox includes the translations from XmManager. Additional behavior The XmMessageBox widget has the additional behavior described below: MAny KCancel: Calls the activate callbacks for the cancel button if it is sen- sitive. KActivate: Calls the activate callbacks for the button with the keyboard focus. If no button has the keyboard focus, calls the activate callbacks for the default button if it is sensitive. <Ok Button Activated>: Calls the callbacks for XmNokCallback. <Cancel Button Activated>: Calls the callbacks for XmNcancelCallback. <Help Button Activated>: Calls the callbacks for XmNhelpCallback. <FocusIn>: Calls the callbacks for XmNfocusCallback. <Map>: Calls the callbacks for XmNmapCallback if the parent is a Dialog- Shell. <Unmap>: Calls the callbacks for XmNunmapCallback if the parent is a Dia- logShell. Virtual bindings The bindings for virtual keys are vendor specific. For information about bindings for virtual buttons and keys, see VirtualBindings(Xm). See also Composite(Xm), Constraint(Xm), Core(Xm), XmBulletinBoard(Xm), XmCreateErrorDialog(Xm), XmCreateInformationDialog(Xm), XmCreateMessageBox(Xm), XmCreateMessageDialog(Xm), XmCreateQuestionDialog(Xm), XmCreateTemplateDialog(Xm), XmCreateWarningDialog(Xm), XmCreateWorkingDialog(Xm), XmManager(Xm) and XmMessageBoxGetChild(Xm).