
XtPopup (XtParent (dialog), XtGrabNone);
}
The intent of this function is to create a dialog that tries to discourage the user from performing a destructive
action. By using a WarningDialog and by making the Cancel button the default choice, we have given the
user adequate warning that the action may have dangerous consequences. The output of a program running
this code fragment is shown in the figure.
Output of WarningMsg()
You can also set the default button for a dialog by the setting the BulletinBoard resource
-XmNdefaultButton. This technique works for both MessageDialogs and SelectionDialogs. The resource
value must be a widget ID, which means that you have to get a handle to a subwidget in the dialog to set the
resource. You can get the handle to subwidgets using XmMessageBoxGetChild() or
XmSelectionBoxGetChild(). Since this method breaks the Motif dialog abstraction, we describe it
later in Section #sinternwid.
6.4.2 Initial Keyboard Focus
When a dialog widget is popped up, one of the internal widgets in the dialog has the keyboard focus. This widget is
typically the default button for the dialog, which makes sense in most cases. However, there are situations where it is
appropriate for another widget to have the initial keyboard focus. For example, when a PromptDialog is popped up, it
makes sense for the TextField to have the keyboard focus so that the user can immediately start typing ...