Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!linac!att!ucbvax!bloom-beacon!dont-send-mail-to-path-lines From: leei@thunder.mcrcim.mcgill.EDU Newsgroups: comp.windows.x Subject: Re: Two Athena widget questions. Message-ID: <9104101639.AA06412@thunder.McRCIM.McGill.EDU> Date: 10 Apr 91 16:39:30 GMT References: <9103281952.AA15167@excess.lcs.mit.edu> Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 41 In message <9103281952.AA15167@excess.lcs.mit.edu> you write: > > > > 2) Is the promise that an asciiTextWidget will call a callback when > the data is modified a lie? I can't seem to register the callback. > The promise that I'm referring to is in Section 5.5.1 of the Athena > Widget Set docs. Under a description of the AsciiText resources, the > entry for callback is: > > callbacks The callbacks registered on this resource will be called > every time the text buffer changes. This is an AsciiSrc > resource. > > >The Ascii Text widget does not have a callback resource. >Add the callback to the Ascii Source, not the Ascii Text. >You can do GetValues on the AsciiText's textSource resource to get the >source object, and add the callback to the source object. > Thanks for the help. This seems to work fine, but as I use it I become unclear on the intended semantics of the callback. At what time is the callback generated? From a quick scan through the AsciiSrc source code, it seems to be sent before the replace operation has actually been completed, so if I do a XtVaGetValues( w, XtNstring, &name, NULL) in my callback routine, I will get the unchanged value! Well, that is supposing that it works. In fact, if the useStringInPlace property is False, this call causes a core dump since the initialization performed before the XtCallCalbacks call in ReplaceText() is invalidated by the XawAsciiSave() call via GetValuesHook(). I'd call it a bug, but since the semantics of the callback seem undefined (at least anywhere I can see in section 5 of the Athena Widget Set docs) it is not clear to me what I'm allowed to do in this callback and what not. If you decide this is a bug, let me know and I'll file a real bug report. If the semantics are intended to be such that by the time the callback is invoked, the string resource should actually be changed, then let me know that too. ------------------------------------------------------------------------------ Lee Iverson McGill Research Centre for Intelligent Machines leei@mcrcim.mcgill.edu Computer Vision and Robotics Lab McGill University, Montreal