[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Programmer's Guide


MessageBox is a BulletinBoard subclass intended for a dialog consisting of a single user interaction. By default, a MessageBox has the following components:

  1. A LabelGadget with a pixmap label symbolizing the type of interaction the MessageBox represents

  2. A LabelGadget with a compound string label representing the text of the message

  3. A SeparatorGadget separating the message symbol and text from the other children

  4. Three buttons: OK, Cancel, and Help

    Typically the message symbol and text are on top and the buttons on the bottom, with the separator between. The application can add additional children to a MessageBox. Additional children are laid out in the following manner:

    1. The first MenuBar child is placed at the top of the window.

    2. All XmPushButton widgets or gadgets, and their subclasses, are placed after the OK button in the order of their creation.

    3. A child that is not in these categories is treated as a work area and 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 buttons. The layout of multiple work area children is undefined.

      Several convenience routines create MessageBox widgets with DialogShell parents for particular kinds of interactions. For most of these routines, the principal difference in the type of MessageBox they create is that each uses a distinct default symbol pixmap. When it creates the symbol pixmap, MessageBox uses XmGetPixmapByDepth to find a pixmap with a name that corresponds to the type of interaction. Each dialog type is also associated with a value of the XmNdialogType resource. The following table shows the correspondence between creation routine, XmNdialogType, and symbol pixmap name:

      Table 5. MessageBox Routines, Dialog Types, and Pixmaps

      Convenience Routine XmNdialogType Pixmap Name
      XmCreateErrorDialog XmDIALOG_ERROR xm_error
      XmCreateInformationDialog XmDIALOG_INFORMATION xm_information
      XmCreateMessageDialog XmDIALOG_MESSAGE
      XmCreateQuestionDialog XmDIALOG_QUESTION xm_question
      XmCreateTemplateDialog XmDIALOG_TEMPLATE
      XmCreateWarningDialog XmDIALOG_WARNING xm_warning
      XmCreateWorkingDialog XmDIALOG_WORKING xm_working

      A MesssageDialog and a TemplateDialog have no default symbol pixmap. A TemplateDialog is a special MessageBox variant that is intended for application customization and that, by default, has no children except the separator.

      Like SelectionBox, MessageBox has XmNokCallback, XmNcancelCallback, and XmNhelpCallback lists to inform the application when the user activates a button. MessageBox has resources for supplying label strings and the symbol pixmap for its children. The widget IDs of the children of a MessageBox are not available as resources. The application can retrieve the widget IDs of the automatically created children by using XtNameToWidget or by calling XmMessageBoxGetChild.

    4. [ Previous | Next | Contents | Glossary | Home | Search ]