Skip to Main Content
Volume 6A: Motif Programming Manual
book

Volume 6A: Motif Programming Manual

by David Brennan, Dan Heller, Paula Ferguson
September 1993
Intermediate to advanced content levelIntermediate to advanced
1014 pages
28h 26m
English
O'Reilly Media, Inc.
Content preview from Volume 6A: Motif Programming Manual
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Volume 7A: XView Programming Manual

Volume 7A: XView Programming Manual

Dan Heller

Publisher Resources

ISBN: 9780596000431