[comp.windows.x] Trouble with setting label in dialog widget

rao@enuxha.eas.asu.edu (Arun Rao) (02/13/90)

	I have a popup shell in my application which contains a dialog
	widget. The label of this dialog widget is set (using XtSetValues)
	just before popping it up in a callback routine, and the
	string displayed varies.

	The trouble is that the XtSetValues() is completely ignored after
	the first call - the label is set once, and does not change, even
	though I've checked that the string I'm using is actually different.

	The code fragment is given below:

	void  callback(w, client_data, call_data)


	....................
	{

		..................

		if(n_vector != 0)
                        sprintf(buffer,"Nearest match is %s, \n%f units away\0",
                                        best_match, min_dist);
                else
                        sprintf(buffer, "Database is empty");
	
                n = 0;
                XtSetArg(wargs[n], XtNlabel, buffer); n++;
                XtSetArg(wargs[n], XtNsensitive, TRUE); n++;
                XtSetValues(client_data->dialog1, wargs, n);
                XtPopup(client_data->popup_shell1, XtGrabExclusive);
		..................
	}



	Any help is greatly appreciated.

	Thanks in advance.

-Arun
-- 
Arun Rao
INTERNET: rao@enuxha.eas.asu.edu,rao@acvax.inre.asu.edu BITNET: agaxr@asuacvax
950 S. Terrace Road, #B324, Tempe, AZ 85281
Phone: (602) 968-1852 (Home) (602) 965-3452 (Office)

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (02/14/90)

> 	I have a popup shell in my application which contains a dialog
> 	widget. The label of this dialog widget is set (using XtSetValues)
> 	just before popping it up in a callback routine, and the
> 	string displayed varies.

> 	The trouble is that the XtSetValues() is completely ignored after
> 	the first call...

What version of Xaw are you using?  R4 or R3 (please oh please don't say R1 or
R2 :-)

I think that SetValues in R3 may have been doing a ptr comparision so that if
you are using the same buffer you lose.  I thought I fixed this in R4 but
it might have slipped by me.

To work around it you can allocate the string with XtNewString() and then free
it after the SetValues() call.  Yea, I know it's ugly.

If this is still ocurring in R4 then please send a bug report to xbugs@expo
using the form supplied in `doc/bugs/bug-report'.


						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213