[comp.windows.x] help with XmCreateDrawingArea

jlunny@TWG.COM ("John Lunny") (12/20/89)

hi,

at the outset i would like to warn you that i am new at this
X programming thing.

i'm trying to port an X Lib application to Motif.  I decided
to go with the XmDrawingArea Widget, so that i could keep my
old X Lib calls.  so i create a drawing area widget via 
XmCreateDrawingArea.  However, the X Lib calls require a window
with which to draw into.  i thought this could easily be the
result of a XtWindow() call on the widget returned from 
XmCreateDrawingArea.  however, when i try to create the graphics
context with this window id, it comes back with a badDrawable
error.  in a nutshell..
	drawingarea = XmCreateDrawingArea (...);
	XtManagechild (drawingarea);
	...
	w = XtWindow (drawingarea);
	XCreateGC (dpy, w, ...);
any ideas???
thanks in advance.
jlunny@twg.com

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

> i'm trying to port an X Lib application to Motif.
>	...
> when i try to create the graphics
> context with this window id, it comes back with a badDrawable
> error.
> 	drawingarea = XmCreateDrawingArea (...);
> 	XtManagechild (drawingarea);
>	...

  Call XtRealizeWidget (see section 2.5 of the Intrinsics)
  with an argument of your toplevel widget.  Windows of widgets are
  created when a widget is realized, not when a widget is created.
  Calling XCreateGC with a window ID of 0 (no window) would give 
  the type of error that you describe.
	
>	w = XtWindow (drawingarea);
>	XCreateGC (dpy, w, ...);


Donna Converse