Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!uxc!uxc.cso.uiuc.edu!m.cs.uiuc.edu!s.cs.uiuc.edu!toh From: toh@s.cs.uiuc.edu Newsgroups: comp.windows.x Subject: Re: Athena dialog widget error? Message-ID: <216500006@s.cs.uiuc.edu> Date: 26 Mar 89 17:42:00 GMT References: <1626@ncar.ucar.edu> Lines: 62 Nf-ID: #R:ncar.ucar.edu:1626:s.cs.uiuc.edu:216500006:000:1854 Nf-From: s.cs.uiuc.edu!toh Mar 26 11:42:00 1989 >/* Written 6:43 pm Mar 22, 1989 by clyne@redcloud.ucar.edu in s.cs.uiuc.edu:comp.windows.x */ >/* ---------- "Athena dialog widget error?" ---------- */ >I'm running release 3 on a Sun 3/260. When I try to *change* the >original value of the label in a dialog widget using XtSetValues I get >a core dump. Although I've seen nothing in the MIT documentation to >lead me to believe otherwise I assume that ALL widget resources are >subject to modification via XtSetValues. Ergo, is my assumption >incorrect or is this a bug in the dialog widget? I had the same problem and faintly remembered that somehow you can't set the value of the Athena Dialog widget. However, I've hacked up some code to do the job, by going right into the primitives... ---------------------------------------------------------------------- #include /* replaces text in a text widget from startPos to endPos by strng */ void gr_TextReplace(wid,startPos,endPos,strng) Widget wid; char *strng; long startPos,endPos; { XtTextBlock text; text.firstPos = 0; text.length = strlen(strng); text.ptr = strng; text.format = FMT8BIT; XtTextReplace(wid,startPos,endPos,&text); } /* Returns the text child widget of an Athena Dialog widget */ Widget gr_DialogGetTextWind(w) Widget w; { return (((DialogWidget)w)->dialog.valueW); } /* Sets the value of the text child widget of an Athena Dialog widget */ void gr_DialogSetValue(wid,strng) Widget wid; char *strng; { Widget textWid; String oldStrng; textWid = ((DialogWidget)wid)->dialog.valueW; oldStrng = ((DialogWidget)wid)->dialog.value; gr_TextReplace(textWid,0,strlen(oldStrng),strng); } =============================================== Eng-Whatt Toh (ewtoh@ncsa.uiuc.edu) National Center for Supercomputing Applications University of Illinois ===============================================