[comp.windows.x] XmLabel "Redisplay" Problem

ohayon@snoopy.src.ricoh.co.jp (Ohayon Tsiel) (10/22/90)

 Hi out there

 I'm using Motif1.1. and my machine is a Sun 3/60 (UNIX), the screen is B&W.

 I've created a "text" window to display Japanese since XmText does not 
 support compound strings yet. This text window has its own widget class.
 This "text" window  is a bulletin board (superclass) with an XmLabel,
 an XmMENU_BAR, and a XmSCROLLED_WINDOW. The scrolled window workarea is a 
 XmDrawingArea. The only child to this XmDrawingArea is a XmLabel in which I 
 display the Japanese text.

			Bulletin Board (superclass)
			      |
			      |
	-----------------------------------------
	|		|			|
     XmLabel	     XmMENU_BAR(RowColumn) XmScrolledWindow
						|
					    XmDrawingArea
						|
					      XmLabel

 My problem is the following. When some of the text is cut off because the
 XmLabel Widget (the scrolled label Widget) is not wide enough, I get a 
 core dump which looks like this:

 _XmStringLineAscender() at 0xb4cec
 _draw() at 0xb5b78
 _XmStringDraw() at 0xb5d14
 `Label`Redisplay() at 0x618f8
 SendExposureEvent() at 0xdc868
 CompressExposures() at 0xdc7e0
 DispatchEvent() at 0xdc374
 DecideToDispatch() at 0xdcc18
 XtDispatchEvent() at 0xdcdac
 XtAppMainLoop() at 0xdd098
 main(argc = 1, argv = 0xf7fffbd4)

 One funny thing about this problem is that when I run in the debugger
 dbx it breaks from time to time only ! Also when I switch to a color SS1 
 there is no problem. Is there a speed problem, since running in the debugger 
 or one a color display is slower ? 

 Also there is no problem when the XmLabel is wide enough.

 Has anybody encountered such a problem ?
 Thanks for any suggestions.

 T. Ohayon

ohayon@snoopy.src.ricoh.co.jp (Ohayon Tsiel) (10/24/90)

Hi out there.

I traced the XmLabel redisplay problem and found out that my program
was crashing when I was doing :
	XtSetArg(arg[0], XmNlabelString, xmstr);
	XtSetValues(labelWidget, arg, 1);

For some reason it was crashing when _XmStringFree was called in the
Label SetValues procedure.

So this is how I got around it, although I shouldn't be doing this, especially
line 1:

XmLabelWidgetClass     	superclass = (XmLabelWidgetClass)xmLabelWidgetClass;
Widget			labelWidget;
XmString		xmstr;

... stuff deleted 

1: ((XmLabelWidget)labelWidget)->label._label = _XmStringCreate(xmstr);
2: XClearWindow(XtDisplay(labelWidget),XtWindow(labelWidget),0,0,
		    (int)XtWidth(labelWidget),(int)XtHeight(labelWidget));
3: (*superclass->core_class.expose)(labelWidget);
4: XmStringFree(xmstr);

The program doesn't break anymore !
Does anybody know why ?

	T. Ohayon