Path: utzoo!attcan!uunet!mcsun!unido!pcsbst!jkh From: jkh@meepmeep.pcs.com (Jordan K. Hubbard) Newsgroups: comp.windows.x Subject: Re: Athena asciiStringWidget questions Message-ID: Date: 28 Oct 89 16:12:54 GMT References: <8909252128.AA28066@mbunix.mitre.org> <8910262127.AA20276@expo.lcs.mit.edu> Sender: news@pcsbst.UUCP Organization: PCS Computer Systems, GmbH Lines: 52 In-reply-to: kit@EXPO.LCS.MIT.EDU's message of 26 Oct 89 21:27:39 GMT This brings up a question I have about the asciiStringWidget, perhaps Chris can help me too. I have an application (the Info browsing widget, for the curious) that uses an ascii string widget to display a section of text from a large allocated chunk of memory. The text widget's "window" into this chunk of memory (and often the chunk of memory itself) changes frequently. This is what I did: XtTextSource oldSource, newSource; .. oldSource = XtTextGetSource(widget); i = 0; XtSetArg(args[i], XtNlength, .. new length ..); i++; XtSetArg(args[i], XtNstring, .. new start ptr in buffer ..); i++; XtSetArg(args[i], XtNtextOptions, (wordBreak | scrollVertical)); i++; newSource = XtStringSourceCreate(widget, args, i); XtTextSetSource(widget, newSource, 0); XtStringSourceDestroy(oldSource); Note that I don't know whether the setting of the textOptions is useless or not. The documentation is quite vague on the question of which resources are destined for the source, and for the sink. Anyway, the long and short of this is that it doesn't work. The starting position in the text widget is set correctly, but the length doesn't seem to have any effect. In fact, everything from the new starting position (represented by a pointer into the buffer) to the END OF THE BUFFER is displayed! This is a real mystery, since I have no idea how the text widget knows how large the entire buffer is. I suspect that it runs into a large contiguous section of nulls or something and gives up. It also may be that the old Source length is maintained somehow (which usually is the length of the entire buffer the first time around). In order to get this to work properly, I had to do the following after creating the new source: ... XtTextDisableRedisplay(widget); XtTextSetSource(widget, newSource, 0); XtStringSourceDestroy(oldSource); XtTextSetLastPos(widget, .. new length ..); XtTextEnableRedisplay(widget); Any clues? Jordan --- -- PCS Computer Systeme GmbH, Munich, West Germany UUCP: pyramid!pcsbst!jkh jkh@meepmeep.pcs.com EUNET: unido!pcsbst!jkh ARPA: jkh@violet.berkeley.edu or hubbard@decwrl.dec.com