dschmidt@athena.mit.edu (Dan Schmidt) (07/14/88)
I'm using the Athena widgets in an X application, and I'm having some trouble with the text widget. I would like to display some text in the widget, and subsequently change the text from time to time. It doesn't like it when I try to change XtNstring, and if I directly change the string that XtNstring refers to, nothing happens. Does anyone know the right thing to do? Dan Schmidt Something I learned today dschmidt@athena.mit.edu Black and white is always gray -- Husker Du It was a giant Adenoid. At least as big as St. Paul's, and growing hour by hour. London, perhaps all England, was in mortal peril! -- Thomas Pynchon
diamant@hpfclp.SDE.HP.COM (John Diamant) (07/15/88)
> I'm using the Athena widgets in an X application, and I'm having some trouble > with the text widget. I would like to display some text in the widget, and > subsequently change the text from time to time. It doesn't like it when > I try to change XtNstring, and if I directly change the string that > XtNstring refers to, nothing happens. Does anyone know the right thing > to do? Are you changing it to something larger than it was originally. If I remember correctly, the text widget sets the maximum size to the initial string and only allocates that much space. You probably have to set the maximum size larger (when you create the widget) before initializing the string to a particular value. John Diamant Software Development Environments Hewlett-Packard Co. ARPA Internet: diamant@hpfclp.sde.hp.com Fort Collins, CO UUCP: {hplabs,hpfcla}!hpfclp!diamant
vixie@palo-alto.DEC.COM (Paul Vixie) (07/15/88)
In article <6190@bloom-beacon.MIT.EDU> dschmidt@athena.mit.edu (Dan Schmidt) writes:
# I'm using the Athena widgets in an X application, and I'm having some trouble
# with the text widget. I would like to display some text in the widget, and
# subsequently change the text from time to time. It doesn't like it when
# I try to change XtNstring, and if I directly change the string that
# XtNstring refers to, nothing happens. Does anyone know the right thing
# to do?
I've done it, but I don't remember the incantation. However, you will be
well-served to look at the source to the text widget (lib/Xaw/Text.c, I
think) and make a note of all the utility routines you find near the bottom.
XtTextRedisplay may be one of them, but no promises. These utility routines
are very nec'y for any real work with Text widgets, but since they aren't
documented I suggest that you schedule time for hair-pulling when R3 comes
out. :-).
Paul Vixie
--
Paul Vixie
Digital Equipment Corporation Work: vixie@dec.com Play: paul@vixie.UUCP
Western Research Laboratory uunet!decwrl!vixie uunet!vixie!paul
Palo Alto, California, USA +1 415 853 6600 +1 415 864 7013
rlh2@eagle.ukc.ac.uk (Richard Hesketh) (07/22/88)
In article <6190@bloom-beacon.MIT.EDU> dschmidt@athena.mit.edu (Dan Schmidt) writes: >I'm using the Athena widgets in an X application, and I'm having some trouble >with the text widget. I would like to display some text in the widget, and >subsequently change the text from time to time. It doesn't like it when >I try to change XtNstring, and if I directly change the string that >XtNstring refers to, nothing happens. Does anyone know the right thing >to do? > I use this work-around but surely there is a better way? String newtext; /* the new text to replace existing text */ Widget dialog; /* the text widget (I use asciiStringWidgetClass) */ XtSetArg(args[i], XtNstring, newtext); i++; XtStringSourceDestroy(XtTextGetSource(dialog)); XtTextSetSource(dialog, XtStringSourceCreate(XtParent(dialog), (ArgList)args, i), 0); Richard
tldavis@athena.mit.edu (Timothy Davis) (07/26/88)
In article <6190@bloom-beacon.MIT.EDU> Dan Schmidt writes: >I would like to display some text in the [Athena text] widget, and >subsequently change the text from time to time... I use the XtTextBlock definition in <TextP.h>, along with a few convenience routines which may or may not be staying around. This worked in the X10 toolkit and seems to be working in my X11 port: XtTextBlock newTextBlock = { 0, 11, "Test String"); XtTextPosition top; XtTextSetLastPos(w, (top=XtTextTopPosition(w))); /* delete the current text */ /* above necessary to get it to work in both X10 and X11 */ XtTextReplace(w,top,top,&newTextBlock); /* would be the only routine required if it worked as advertised */ ---------- I have another problem with the asciiText widget, related to the design of the callback registration mechanism: This widget has no mechanism which I can find to call user callback routines! The simple addition of an XtCallback callback list, and a Notify action in the actions table which would do XtCallCallbacks() would add SO MUCH functionality. I could grab the contents of a text edit window when the user has filled it in and hit, for example, the RETURN or DO key. Shouldn't there be a minimum callback functionality for any widget which supports translation management? I would have expected the XtCallback list to be a part of Core or Simple. I sincerely don't want to have to write a subclass widget of asciiTextWidgetClass in order to add my needed functionality. By the way, I can't get XtAddEventHandler() to register my (second) event handler to a widget either. That's another option to the above. If anyone has a way to make XtAddEventHandler() work, please send me sample code. Thanks, Tim Davis Courseware Development, MIT
tldavis@athena.mit.edu (Timothy Davis) (07/27/88)
In article <6190@bloom-beacon.MIT.EDU> Dan Schmidt writes: >I would like to display some text in the [Athena text] widget, and >subsequently change the text from time to time... I use the XtTextBlock definition in <TextP.h>, along with a few convenience routines which may or may not be staying around. This worked in the X10 toolkit and seems to be working in my X11 port: XtTextBlock newTextBlock = { 0, 11, "Test String"); XtTextPosition top; XtTextSetLastPos(w, (top=XtTextTopPosition(w))); /* delete the current text */ /* above necessary to get it to work in both X10 and X11 */ XtTextReplace(w,top,top,&newTextBlock); /* would be the only routine required if it worked as advertised */ ---------- I have another problem with the asciiText widget, related to the design of the callback registration mechanism: This widget has no mechanism which I can find to call user callback routines! The simple addition of an XtNcallback callback list, and a Notify action in the actions table which would do XtCallCallbacks() would add much needed functionality. One could grab the contents of a text edit window when the user has filled it in and hit, for example, the RETURN or DO keys. Shouldn't there be a minimum callback functionality for any widget which supports translation management? I would have expected the XtNcallback list to be a part of Core or Simple. I sincerely don't want to have to write a subclass widget of asciiTextWidgetClass in order to add my needed functionality. By the way, I can't get XtAddEventHandler() to register my (second) event handler to a widget either. That's another option to the above. If anyone has a way to make XtAddEventHandler() work for the text widget, please send me sample code. Thanks, Tim Davis Student Courseware Development, MIT