Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

DwtCautionBox(3Dwt)

Name

DwtCautionBox, DwtCautionBoxCreate − Creates a caution box widget for the application to display caution messages. 

Syntax

Widget DwtCautionBox(parent_widget, name, default_position,
                     x, y, style, label,
                     yeslabel, nolabel, cancel_label,
                     default_push_button, callback,
                     help_callback)
     Widget parent_widget;
     char *name;
     Boolean default_position;
     Position x, y;
     int style;
     DwtCompString label;
     DwtCompString yeslabel;
     DwtCompString nolabel;
     DwtCompString cancel_label;
     int default_push_button;
     DwtCallbackPtr callback, help_callback;

Widget DwtCautionBoxCreate (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 caution 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 DwtCautionBoxCreate. 

yeslabelSpecifies the label for the Yes push button.  If the label is a zero length string, the button is not displayed.  This argument sets the DwtNyesLabel attribute associated with DwtCautionBoxCreate. 

nolabelSpecifies the label for the No push button.  If the label is a zero length string, the button is not displayed.  This argument sets the DwtNnoLabel attribute associated with DwtCautionBoxCreate. 

cancel_labelSpecifies the label for the Cancel push button.  If the label is a NULL string, the button is not displayed.  This argument sets the DwtNcancelLabel attribute associated with DwtCautionBoxCreate. 

default_push_button
Specifies the push button that represents the default user action. You can pass DwtYesButton, DwtNoButton, or DwtCancelButton.  This argument sets the DwtNdefaultPushbutton attribute associated with DwtCautionBoxCreate. 

callbackSpecifies the callback function or functions called when the user activates the Yes, No, or Cancel buttons.  This argument sets the DwtNyesCallback, DwtNnoCallback, and DwtNcancelCallback attributes associated with DwtCautionBoxCreate. 

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 DwtCautionBox and DwtCautionBoxCreate functions create a caution box widget and return its associated widget ID.  When calling DwtCautionBox, you set the caution box widget attributes presented in the formal parameter list.  For DwtCautionBoxCreate, however, you specify a list of attribute name/value pairs that represent all the possible caution box widget attributes. 

A caution box warns the user of the application of the consequences of carrying out an action.  It stops application activity and requires the user to provide instructions on how to proceed.  Your application should generate a caution box when an action by the user could destroy data or cause a simialr irrevocable event.  The caution box usually contains Yes, No, and Cancel push buttons.  When possible, caution messages should be written as inquiries.  In all cases, the default push button should be the least destructive operation.  If DwtNstyle is DwtModal when the user activates any 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
DwtNyesLabel DwtCompString "Yes"
DwtNnoLabel DwtCompString "No"
DwtNcancelLabel DwtCompString "Cancel"
DwtNdefaultPushbutton unsigned char DwtYesButton
DwtNyesCallback DwtCallbackPtr NULL
DwtNnoCallback DwtCallbackPtr NULL
DwtNcancelCallback DwtCallbackPtr NULL

DwtNlabelSpecifies the text in the message line or lines. 

DwtNyesLabelSpecifies the label for the Yes push button.  If the label is a zero length string, the button is not displayed. 

DwtNnoLabelSpecifies the label for the No push button.  If the label is a zero length string, the button is not displayed. 

DwtNcancelLabel
Specifies the label for the Cancel push button. If the label is a NULL string, the button is not displayed.

DwtNdefaultPushbutton
Specifies the push button that represents the default user action. You can pass DwtYesButton, DwtNoButton, or DwtCancelButton. 

DwtNyesCallback
Specifies the callback function or functions called when the user clicks on the Yes button. For this callback, the reason is DwtCRYes. 

DwtNnoCallbackSpecifies the callback function or functions called when the user clicks on the No button.  For this callback, the reason is DwtCRNo. 

DwtNcancelCallback
Specifies the callback function or functions called when the user clicks on the Cancel button. For this callback, the reason is DwtCRCancel. 

Return Value

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. 
DwtCRNo The user activated the No button. 
DwtCRCancel The user activated the Cancel button. 
DwtCRFocus The caution box has received the input focus. 
DwtCRHelpRequested The user selected Help somewhere in the caution 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

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