Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bloom-beacon!CRL.DEC.COM!treese From: treese@CRL.DEC.COM (Win Treese) Newsgroups: comp.windows.x Subject: Re: Help changing source with Athena Text Widget. Message-ID: <8905262324.AA01761@cirocco.DEC.COM> Date: 26 May 89 23:24:32 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 42 > > Can someone send me, or point me in the direction of, help or a simple > example of how to change sources with a Text Widget. I have tried changing > the XtNstring and XtNfile values with XtSetValues and XtTextSetValues. I > am sure I am missing the obvious. SetValues isn't the way to go here. Here's a short function that does the job: /* Function: SetTextFile() sets the text file of the specified widget. * Arguments: w: Widget to set. * filename: Name of filename. * Returns: Nothing. * Notes: */ void SetTextFile(w, filename) Widget w; char *filename; { Arg args[10]; Cardinal arg_cnt; XtTextSource new_src; XtTextSource old_src; old_src = XtTextGetSource(w); arg_cnt = 0; XtSetArg(args[arg_cnt], XtNfile, filename); arg_cnt++; new_src = XtDiskSourceCreate(w, args, arg_cnt); XtTextSetSource(w, new_src, (XtTextPosition) 0); XtDiskSourceDestroy(old_src); } Happy hacking. Win Treese Cambridge Research Lab treese@crl.dec.com Digital Equipment Corp.