Path: utzoo!censor!geac!jtsv16!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!EXPO.LCS.MIT.EDU!kit From: kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: Athena asciiStringWidget questions Message-ID: <8911272047.AA05542@expo.lcs.mit.edu> Date: 27 Nov 89 20:47:58 GMT References: Sender: root@athena.mit.edu (Wizard A. Root) Organization: The Internet Lines: 50 > 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. Setting the options is useless. The docs will be better in R4, promise. > 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. If I understand you correctly the problem appears to be that you are misinterpreting the function of the length resource. This resource specifies the length of the buffer that the text widget will use, in place, to contain the string. The text that is displayed is a normal NULL terminated Latin1 string. The end of the displayed string is determined by using strlen(). The length is used to keep the Text widget from overwriting the end of the buffer when the Text widget is in edit mode. > Any clues? > Jordan I hope that clears things up a bit. Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213