wong@h.cs.wvu.wvnet.edu (Hiulum Wong) (02/03/89)
I have an editable Text string widget. How can I get the string value after I edit the text? Is there any way to get the position of last charactor in the text window? Please email to the following address if you have the answer. Thanks in advance. wong@b.cs.wvu.wvunet.edu
yong%metasoft@bbn.com (02/03/89)
In article <281@h.cs.wvu.wvnet.edu>, wong@h.cs.wvu.wvnet.edu (Hiulum Wong) writes: > > I have an editable Text string widget. How can I get the > string value after I edit the text? Is there any way to get > the position of last charactor in the text window? > Please email to the following address if you have the > answer. Thanks in advance. > > wong@b.cs.wvu.wvunet.edu I would like to know the answer also. Thanks to any enlightening from Xt experts in advance. ============================================================ yong%metasoft@bbn.com uunet!bbn!metasoft!yong
swick@ATHENA.MIT.EDU (Ralph R. Swick) (02/03/89)
> I have an editable Text string widget. How can I get the > string value after I edit the text? If you have allocated your own buffer and passed it as the value of the XtNstring resource, then the text will be right there; AsciiStringWidget uses your buffer in-place. (This is documented in a note in the description of the Xaw Text widget). If you let the widget allocate it's own (default) buffer, then life is pretty complicated. The Text widget is currently missing some methods to conveniently allow you to retrieve the text. There _are_ a couple of ways that are unlikely to break as we improve the widget (e.g. calling the source's Read method directly), but you're really better off allocating your own buffer in the first place. >Is there any way to get >the position of last charactor in the text window? Yes, if by position you mean the XtTextPosition. The following will do the trick (with side-effects; again, we're missing some code): XtTextPosition last; XtTextSetInsertionPoint(w, 9999999); last = XtTextGetInsertionPoint(w);