[comp.windows.x] Athena dialog widget error?

clyne@redcloud.ucar.edu (John Clyne) (03/23/89)

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? 

jc


	John Clyne 	(clyne@bierstadt.ucar.edu)
	c/o
	National Center for Atmospheric Research
	P.O. Box 3000
	Boulder, Colorado 80307
	(303) 497-1236

	
		%%% Its a small world. But I wouldn't want to paint it %%%
						S. Wright
		%%%						       %%%

 

kit@ATHENA.MIT.EDU (Chris D. Peterson) (03/24/89)

> 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. 

This is a know bug in the Dialog widget.

> 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.

That is true, all resource are settable, unless it is explicately stated
otherwise, in any case it shouldn't dump core.  

						Chris D. Peterson     
						MIT X Consortium /
						Project Athena 

Net:	kit@athena.mit.edu		
Phone: (617) 253 - 1326			
USMail: MIT - Room E40-321
	77 Massachusetts Ave.		
	Cambridge, MA 02139		

toh@s.cs.uiuc.edu (03/27/89)

>/* 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 <X11/DialogP.h>

/* 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
===============================================