DwtMessageBox(3Dwt)
Name
DwtMessageBox, DwtMessageBoxCreate − Creates a message box widget for the application to display text to the user.
Syntax
Widget DwtMessageBox(parent_widget, name, default_position,
x, y, style, ok_label, label,
callback, help_callback)
Widget parent_widget;
char *name;
Boolean default_position;
Position x, y;
int style;
DwtCompString ok_label, label;
DwtCallbackPtr callback;
DwtCallbackPtr help_callback;
Widget DwtMessageBoxCreate (parent_widget, name,
override_arglist,
override_argcount)
Widget parent_widget;
char *name;
ArgList override_arglist;
int override_argcount;
Arguments
parent_widget
Specifies the parent widget ID.
nameSpecifies the name of the created widget.
default_position
Specifies a boolean value that, when True, causes DwtNx and DwtNy to be ignored and forces the default widget position. The default widget position is centered in the parent window. If False, the specified DwtNx and DwtNy attributes are used to position the widget. This argument sets the DwtNdefaultPosition attribute associated with DwtDialogBoxCreate.
xSpecifies the placement, in pixels, of the left side of the widget window relative to the inner upper left corner of the parent window. This argument sets the DwtNx core widget attribute.
ySpecifies, in pixels, the placement of the upper left corner of the widget window relative to the inner upper left corner of the parent window. This argument sets the DwtNy core widget attribute.
styleSpecifies the style of the dialog box widget. You can pass DwtModal (modal) or DwtModeless (modeless). This argument sets the DwtNstyle attribute associated with DwtDialogBoxPopupCreate.
labelSpecifies the text in the message line or lines. This argument sets the DwtNlabel attribute associated with DwtMessageBoxCreate.
ok_labelSpecifies the label for the Ok push button. If the label is a NULL string, the button is not displayed. This argument sets the DwtNokLabel attribute associated with DwtMessageBoxCreate.
callbackSpecifies the callback function or functions called when the user activates the OK push button. This argument sets the DwtNyesCallback attribute associated with DwtMessageBoxCreate.
help_callbackSpecifies the callback function or functions called when a help request is made. This argument sets the DwtNhelpCallback common widget attribute.
parent_widget
Specifies the parent widget ID.
nameSpecifies the name of the created widget.
override_arglist
Specifies the application override argument list.
override_argcount
Specifies the number of attributes in the application override argument list (override_arglist).
Description
The DwtMessageBox and DwtMessageBoxCreate functions create an instance of the message box widget and return its associated widget ID. When calling DwtMessageBox, you set the message box attributes presented in the formal parameter list. For DwtMessageBoxCreate, however, you specify a list of attribute name/value pairs that represent all the possible message box widget attributes.
The DwtMessageBoxCreate function conforms to the XUI Style Guide by providing optional secondary text below the primary text. This function also supports alignment mode for both the DwtNlabelAlignment and DwtNsecondLabelAlignment attributes.
The message box widget is a dialog box that allows the application to display informational messages to the user. You call this function to create a message box when the user does something unexpected, or when your application needs to display information to the user. The message box widget may contain an OK push button. When the style is DwtModal, the message box freezes the application and requires the user to explicitly dismiss the message box before the application proceeds. If the style is DwtModal when the user selects the OK push button, the widget is cleared from the screen but not destroyed. You can redisplay the widget by calling XtManageChild.
Inherited Attributes
| Attribute Name | Data Type | Default |
| Core Attributes | ||
| DwtNx | Position | Determined by the geometry manager |
| DwtNy | Position | Determined by the geometry manager |
| DwtNwidth | Dimension | 5 pixels |
| DwtNheight | Dimension | 5 pixels |
| DwtNborderWidth | Dimension | One pixel |
| DwtNborder | Pixel | Default foreground color |
| DwtNborderPixmap | Pixmap | NULL |
| DwtNbackground | Pixel | Default background color |
| DwtNbackgroundPixmap | Pixmap | NULL |
| DwtNcolormap | Colormap | Default color map |
| DwtNsensitive | Boolean | True |
| DwtNancestorSensitive | Boolean | The bitwise AND of the parent widget’s DwtNsensitive and DwtNancestorSensitive attributes |
| DwtNaccelerators | XtTranslations | NULL |
| DwtNdepth | int | Depth of the parent window |
| DwtNtranslations | XtTranslations | NULL |
| DwtNmappedWhenManaged | Boolean | True |
| DwtNscreen | Screen * | The parent screen |
| DwtNdestroyCallback | DwtCallbackPtr | NULL |
| Dialog Pop-Up Attributes | ||
| DwtNforeground | Pixel | Default foreground color |
| DwtNhighlight | Pixel | Default foreground color |
| DwtNhighlightPixmap | Pixmap | NULL |
| DwtNuserData | Opaque * | NULL |
| DwtNfont | DwtFontList | The default XUI Toolkit font |
| DwtNhelpCallback | DwtCallbackPtr | NULL |
| DwtNdirectionRToL | NOT SUPPORTED | |
| DwtNunits | NOT SUPPORTED | |
| DwtNtitle | DwtCompString | Widget name |
| DwtNstyle | unsigned char | DwtModal |
| DwtNmapCallback | DwtCallbackPtr | NULL |
| DwtNunmapCallback | DwtCallbackPtr | NULL |
| DwtNfocusCallback | DwtCallbackPtr | NULL |
| DwtNtextMergeTranslations | NOT SUPPORTED | |
| DwtNmarginWidth | Dimension | 12 pixels |
| DwtNmarginHeight | Dimension | 10 pixels |
| DwtNdefaultPosition | Boolean | False |
| DwtNchildOverlap | NOT SUPPORTED | |
| DwtNresize | unsigned char | DwtResizeShrinkWrap |
| DwtNtakeFocus | Boolean | True for modal dialog box |
| False for modeless dialog box |
||
| DwtNnoResize | Boolean | True (that is, no window manager resize button) |
| DwtNautoUnmanage | Boolean | True |
| DwtNdefaultButton | NOT SUPPORTED | |
| DwtNcancelButton | NOT SUPPORTED |
Widget-Specific Attributes
| Attribute Name | Data Type | Default |
| DwtNlabel | DwtCompString | Widget name |
| DwtNokLabel | DwtCompString | "Acknowledged" |
| DwtNyesCallback | DwtCallbackPtr | NULL |
| DwtNsecondLabel | DwtCompString | NULL |
| DwtNlabelAlignment | unsigned char | DwtAlignmentCenter |
| DwtNsecondLabelAlignment | unsigned char | DwtAlignmentBeginning |
| DwtNiconPixmap | Pixmap | The default is the standard icon provided for each message-class widget as follows: (1) the default caution box icon is an exclamation point; (2) the default message box icon is an asterisk; (3) the default work box icon is the wait cursor (watch). See the XUI Style Guide for illustrations of the icons for each message class widget. |
DwtNlabelSpecifies the text in the message line or lines.
DwtNokLabelSpecifies the label for the Ok push button. If the label is a NULL string, the button is not displayed.
DwtNyesCallback
Specifies the callback function or functions called when the user clicks on the Yes button. For this callback, the reason is DwtCRYes.
DwtNsecondLabel
Specifies the text for the secondary label. If the application specifies a second label and then wants to remove it, it should use XtSetValues to set DwtNsecondLabel to NULL or to an empty compound-string.
DwtNlabelAlignment
Specifies the alignment for the primary label. You can pass DwtAlignmentCenter (center alignment), DwtAlignmentBeginning (alignment at the beginning), or DwtAlignmentEnd (alignment at the end).
DwtNsecondLabelAlignment
Specifies the alignment for the secondary label. You can pass DwtAlignmentCenter (center alignment), DwtAlignmentBeginning (alignment at the beginning), or DwtAlignmentEnd (alignment at the end).
DwtNiconPixmapSpecifies the pixmap used for the icon.
Return Values
These functions return the ID of the created widget.
Callback Information
The following structure is returned to your callback:
typedef struct {
int reason;
XEvent *event;
} DwtAnyCallbackStruct;
The reason member is set to a constant that represents the reason why this callback was invoked. For this callback, the reason member can be set to:
| DwtCRYes | The user activated the Yes button. |
| DwtCRFocus | The message box has received the input focus. |
| DwtCRHelpRequested | The user selected Help somewhere in the message box. |
The event member is a pointer to the Xlib structure XEvent, which describes the event that generated this callback. This structure is a union of the individual structures declared for each event type. For information on XEvent and event processing, see the Guide to the Xlib Library: C Language Binding.
See Also
Guide to the XUI Toolkit: C Language Binding
Guide to the XUI Toolkit Intrinsics: C Language Binding