Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!gatech!emory!stiatl!meo From: meo@stiatl.UUCP (Miles O'Neal) Newsgroups: comp.windows.x Subject: TextWidget - getting text Message-ID: <7215@stiatl.UUCP> Date: 9 Oct 89 17:00:44 GMT Organization: Sales Technologies Inc., "The Little Shop of Horrors..." Lines: 43 Someone asked how to get text from a buffer in the TextWidget. The following worked for us. ------------------------------------------------------------------------------- /* Copyright 1988, Sales Technologies, Inc. We don't use this code, so feel free to use it however you wish! */ #include ... char *GetTextFromScreen (w) Widget w; { static XtTextBlock tb; TextWidget ww = (TextWidget) w; (*ww->text.source->Read) (ww->text.source, 0l, &tb, 2000); return tb.ptr; } ------------------------------------------------------------------------------- Note that it accesses private widget data and requires the private header file. We tried using the corresponding text replacement routines to write to the text widget, but only got the 1st 2 characters to show up; the rest of the widget was blanked out. This was under X11R2 - by the time R3 was up, we had written a replacement for the TextWidget (VERY limited functionality compared to the TW - don't think I threw together a true replacement!), so I don't know whether the text replacement would work under R3 or not. We never got it to work. We use the default buffer allocated by the TW. -Miles O'Neal {yr fave backbone here}!gatech!stiatl!meo