Article View: comp.windows.x
Article #37214Re: Xaw Text Widget Question (Scrolling Insert)
From: Chris D. Peterson
Date: Thu, 22 Feb 1990 18:36
Date: Thu, 22 Feb 1990 18:36
65 lines
2711 bytes
2711 bytes
[ I am cc'ing this to xpert, because it may be of general interest. ]
>> Xev
> me
me
> > I have a text widget that I am trying to place text into. The text in
> > question is a long line, and I would like to be able to insert it and
> > have it wrap, as opposed to running off the edge of the widget.
> It works like a champ for me. If you send me a short example
> program I will see what I can do.
>
There are some interesting problems here. But there is nothing that is a
show-stopper. The first is that word wrap does not get activated if you have
XawtextResizeWidth set. This actually makes sense because if you are always
resizing to a new width then you should never need to wrap. Of course, there
are times when the resize request will be denied, and then you would like to
wrap, unfortunatly the current code does not do the right thing in this case.
The moral of the story is that you do no want to use a wrap wrap mode that is
other than never with resize width, since the wrapping will never get invoked.
The second problem is that the Text widget does not attempt a resize width when
the text is changed with SetValues, or XtTextReplace(). This bug is known, but
has not been fixed. If you click with one of the pointer buttons in the text
widget after the new string has been added the text widget will then resize
itself. The Xmh dialog boxes show the same bug.
I hope this gives you enough information to work around your problems. I have
include some example code fragments to help you understand how the words above
would translate into your source code.
Chris D. Peterson
MIT X Consortium
Net: kit@expo.lcs.mit.edu
Phone: (617) 253 - 9608
Address: MIT - Room NE43-213
----------------------------------------------------------------
ProjectForm = XtCreateManagedWidget "form", formWidgetClass,
parent, NULL, ZERO);
n = 0;
.
.
.
#ifdef USE_WORD_WRAP
XtSetArg (args[n], XtNwrap, XawtextWrapWord); n++;
#else
XtSetArg (args[n], XtNresize, XawtextResizeWidth); n++;
XtSetArg (args[n], XtNresizable, TRUE); n++ /* a form constraint resource. */
#endif
.
.
.
TextDisplay = XtCreateManagedWidget ("TextDisplay",
asciiTextWidgetClass,
ProjectForm, args, n);
Technical Details
Message-ID:
<9002221836.AA01647@expo.lcs.mit.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!bloom-beacon!EXPO.LCS.MIT.EDU!kitShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!bloom-beacon!EXPO.LCS.MIT.EDU!kit From: kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: Xaw Text Widget Question (Scrolling Insert) Message-ID: <9002221836.AA01647@expo.lcs.mit.edu> Date: 22 Feb 90 18:36:40 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 65