Path: utzoo!attcan!telly!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!bloom-beacon!dont-send-mail-to-path-lines From: morreale@bierstadt.scd.ucar.EDU (Peter Morreale) Newsgroups: comp.windows.x Subject: Re: Writing text to a widget Message-ID: <9102060350.AA05278@bierstadt.scd.ucar.EDU> Date: 6 Feb 91 03:50:40 GMT References: <1991Feb6.015649.28798@agate.berkeley.edu> Sender: daemon@athena.mit.edu (Mr Background) Organization: Scientific Computing Division/NCAR, Boulder, CO Lines: 44 In article <1991Feb6.015649.28798@agate.berkeley.edu> you write: > > this is probably easy to do, but i am having a great deal of trouble trying >to implement it. i would like to output information to the user (much as >one would do with printf statements) and have it displayed in a widget, >any widget. the Athena text widget is much more than i need. how does one >write a string of text to a widget, and continue to write strings on >successive lines as they become appropriate? > >thanx, >bruce >(brp@bandit.berkeley.edu) Sounds like you actually have two requests here. One for a simple widget to display messages, and another for a widget for appending text. What I use for simple one line informative messages is a label widget. It is intended for output strings only (no editing of the string) and I get to have the string auto-centered. To set the label: XtSetArg(arg, XtNlabel, "string"); XtSetValues( , arg, 1); You can also "clear" the widget by setting the string to a null string: XtSetArg(arg, XtNlabel, ""); For the second, still use the text widget, but check out the routines: XawTextSourceRead(), XawTextSourceReplace(). These functions allow you to read and replace (or append) portions of the text buffer. I haven't used these functions directly, so I cannot send any code samples... Hope this helps, -PWM -- ------------------------------------------------------------------ Peter W. Morreale email: morreale@ncar.ucar.edu Nat'l Center for Atmos Research voice: (303) 497-1293 Scientific Computing Division Consulting Office ------------------------------------------------------------------