Path: utzoo!attcan!uunet!cs.utexas.edu!usc!apple!bloom-beacon!EXPO.LCS.MIT.EDU!kit From: kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: Resetting asciiStringWidgets Message-ID: <8906271657.AA09052@expo.lcs.mit.edu> Date: 27 Jun 89 16:57:50 GMT References: <8906261605.AA14390@expo.lcs.mit.edu> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 38 [ William Hagins writes: ] > > and I have tried to > > assign each string to a variable name, and then assigning the variable > > string to null. [ Donna Converse writes: ] > If I understand you correctly: > Don't re-assign the address of the string. Think of the address of the > string as specifying a buffer. To reset the string displayed by the > nbuffer, set the first character in the buffer to the null character. > The asciiStringWidget uses the buffer in-place; if you loose the address > of the buffer, you loose control over what it contains. A bit more information on this one: The string resource should be treated as a READ ONLY buffer. There are only two acceptable methods of changing the string in a text widget from inside an application. 1) With an editable text widget you may use XtTextReplace(). You can modify the text widget's translations to make an editable text widget be unmodifiable by the user. 2) You may also destroy the StringSource and create a new StringSource. This will give you a new string. Since the text widget maintains internal state, changing the string out from underneath it may cause strange and unpredictable results. Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213