[comp.windows.x] DialogWidget problems...

bajan@OPUS.CS.MCGILL.CA (Alan Emtage) (05/26/89)

	While Rick (ricks@AMES.ARC.NASA.GOV) is on the subject, I'm having a
similar kind of problem with the dialog widget myself. After a number of
cycles of changing (and re-reading) the value in the AsciiWidget
subwidget, the Dialog widget just locks up and doesn't allow any more
input. I'm going to try to figure out what is wrong but would like to see
if anybody else has encountered this problem before I start staring at
its innards. 

	BTW, I'm running X11R3 patches 1-8 with SunOS 3.5.

Alan (bajan@cs.mcgill.ca or listmaster@cs.mcgill.ca)

kochhar@endor.harvard.edu (Sandeep Kochhar) (08/07/89)

hi!

While using the dialogWidget, I find that if I change the
value string after  the widget is realized, using
XtSetValues on XtNvalue, then while the dialog box displays
the new string, I never get back the new value that's been typed
in using XtDialogGetValueString().
Any ideas?.
thanks in advance.



Sandeep Kochhar
(617) 495-9515              mail: kochhar@harvard.harvard.edu
Harvard University                kochhar@harvard.csnet
33 Oxford st,                     kochhar@harvard.uucp
Cambridge, Ma 02138               kochhar@harvard.bitnet

"If you didn't get this message, please let me know."

converse@EXPO.LCS.MIT.EDU (Donna Converse) (08/08/89)

> While using the dialogWidget, I find that if I change the
> value string after  the widget is realized, using
> XtSetValues on XtNvalue, then while the dialog box displays
> the new string, I never get back the new value that's been typed
> in using XtDialogGetValueString().
> Any ideas?.

Do you print out the string that XtDialogGetValueString returns,
or are you using it to set the label?   If the label string is in
volatile memory, and you are using XtDialogGetValueString to get
something to set the label, it could lead you to think that the 
problem is with the value.  

Donna Converse
converse@expo.lcs.mit.edu

kochhar@HARVARD.HARVARD.EDU (08/10/89)

	> While using the dialogWidget, I find that if I change the
	> value string after  the widget is realized, using
	> XtSetValues on XtNvalue, then while the dialog box displays
	> the new string, I never get back the new value that's been typed
	> in using XtDialogGetValueString().
	> Any ideas?.

	Do you print out the string that XtDialogGetValueString returns,
	or are you using it to set the label?   If the label string is in
	volatile memory, and you are using XtDialogGetValueString to get
	something to set the label, it could lead you to think that the 
	problem is with the value.  

	Donna Converse
	converse@expo.lcs.mit.edu


I actually just printed out the value (the original intention was to copy
it to a malloced string) and got the above mentioned problems.  
thx.

Sandeep Kochhar
(617) 495-9515              mail: kochhar@harvard.harvard.edu
Harvard University                kochhar@harvard.csnet
33 Oxford st,                     kochhar@harvard.uucp
Cambridge, Ma 02138               kochhar@harvard.bitnet

kochhar@endor.harvard.edu (Sandeep Kochhar) (08/14/89)

(I'm sorry to use the net for this, but I lost the original 
mail and the person's address).

Recently someone else had mentioned the fact that
XtDialogGetValueString didn't produce the right result, (after an
XtSetValues call on XtNvalue).  Here's a simple fix to the file
Dialog.c to solve the problem;  basically, the original Dialog Widget
ignored XtSetValues on the value string.  I just added it, and
everything seems to work fine.


----------------- cut here --------------------
*** /tmp/Dialog.c	Mon Aug 14 00:51:12 1989
--- ./Dialog.c	Sat Aug 12 19:48:24 1989
***************
*** 229,234 ****
--- 229,247 ----
  	XtSetValues( w->dialog.labelW, args, XtNumber(args) );
      }
  
+     if (w->dialog.value != old->dialog.value
+ 	|| (w->dialog.value != NULL
+ 	    && old->dialog.value != NULL
+ 	    && strcmp(w->dialog.value, old->dialog.value))
+ 	)
+     {
+ 	strcpy(old->dialog.value, w->dialog.value);
+ 	w->dialog.value = old->dialog.value;
+ 	XtTextSetLastPos(w->dialog.valueW, strlen(w->dialog.value));
+ 	XtTextSetInsertionPoint(w->dialog.valueW, 0);
+ 	XtTextDisplay(w->dialog.valueW);
+     }
+ 
      return False;
  }
----------------- cut here --------------------


Sandeep Kochhar
(617) 495-9515              mail: kochhar@harvard.harvard.edu
Harvard University                kochhar@harvard.csnet
33 Oxford st,                     kochhar@harvard.uucp
Cambridge, Ma 02138               kochhar@harvard.bitnet

"If you didn't get this message, please let me know."