Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!ATHENA.MIT.EDU!swick From: swick@ATHENA.MIT.EDU (Ralph R. Swick) Newsgroups: comp.windows.x Subject: Re: Get text string from text widget Message-ID: <8902031544.AA03421@LYRE.MIT.EDU> Date: 3 Feb 89 15:44:45 GMT References: <281@h.cs.wvu.wvnet.edu> Sender: daemon@bloom-beacon.MIT.EDU Organization: DEC/MIT Project Athena Lines: 26 > 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);