
Output of prompt_dlg.c
The callback routine for each of the PushButtons, pushed(), creates a PromptDialog that prompts the user to enter a
new name for the PushButton. The PushButton is passed as the client_data to the XmNokCallback routine,
read_name(), so that the routine can set the label of the PushButton directly from inside the callback. The
read_name() function destroys the dialog once it has set the label, since the dialog is no longer needed.
If the Cancel button is pressed, the text is not needed, so we can simply destroy the dialog. Since the first parameter to
a dialog callback routine is the dialog widget, we can use XtDestroyWidget as the callback routine. Since the
function only takes one parameter, and the widget that is to be destroyed is passed as the first parameter, no client data
is needed. We set XmNautoUnmanage to False for the dialog because the application is assuming the
responsibility of managing the dialog. There is no help for the dialog so the Help button is disabled by setting it
insensitive.
The text area in the PromptDialog is a TextField widget, so you can get a handle to it and set TextField widget
resources accordingly. Use XmSelectionBoxGetChild() to access the widget. In order to promote the
single−entity abstraction, the dialog provides two resources that affect the TextField widget. You can set the
XmNtextString resource to change the value of the text ...