XtSetArg (args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
XtSetArg (args[n], XmNeditable, False); n++;
XtSetArg (args[n], XmNcursorPositionVisible, False); n++;
XtSetArg (args[n], XmNwordWrap, True); n++;
XtSetArg (args[n], XmNvalue, buf); n++;
XtSetArg (args[n], XmNrows, 5); n++;
text_w = XmCreateScrolledText(form, "help_text", args, n);
XtVaSetValues (XtParent (text_w),
XmNleftAttachment, XmATTACH_WIDGET,
XmNleftWidget, label,
XmNtopAttachment, XmATTACH_FORM,
XmNrightAttachment, XmATTACH_FORM,
XmNbottomAttachment, XmATTACH_FORM,
NULL);
XtManageChild (text_w);
In order to use XmCreateScrolledText(), we must use the old−style XtSetArg() method of setting the
resources that are passed to the function. The routine actually creates two widgets that appear to be a single interface
object. A ScrolledWindow widget and a Text widget are created so that the Text widget is a child of the
ScrolledWindow. The toolkit returns a handle to the Text widget, but since the ScrolledWindow widget is the direct
child of the Form, we set the constraint resources on the ScrolledWindow, not the Text widget. The top, right, and
bottom sides of the ScrolledWindow are attached to the Form, while the left side is attached to the Label widget, so
that the two widgets are always positioned next to each other.
We could have passed these resource/value pairs in the args list, but then the resources would have been set on both
the ScrolledWindow widget and the Text widget. Since the attachment constraints would be ...