[comp.windows.x] Xlib drawing routines in DEC widgets

dmitc@BRAHMS.CS.BYU.EDU (David Mitchell) (02/09/90)

   I used DwtMainWindow to create a main window widget which seemed to
work fine.  I also defined menu widgets as children of the main
window widget.  I also defined a widget for drawing (lines, rectangles
etc.) by using the DwtWindow call.  I get the screen, display, and
window from the XtScreen, XtDisplay, and XtWindow calls using
the widget I defined for drawing as the argument for these calls.
When I then use these returned values to XDrawLine the line will not
appear on the display.
   Can anyone help me with this? Example code would be most helpful.

Dave Mitchell 
email address: dmitc@brahms.byu.edu

klee@chico.pa.dec.com (Ken Lee) (02/09/90)

In article <9002081943.AA01411@brahms.cs.byu.edu>,
dmitc@BRAHMS.CS.BYU.EDU (David Mitchell) writes:
> I also defined a widget for drawing (lines, rectangles
> etc.) by using the DwtWindow call.  I get the screen, display, and
> window from the XtScreen, XtDisplay, and XtWindow calls using
> the widget I defined for drawing as the argument for these calls.
> When I then use these returned values to XDrawLine the line will not
> appear on the display.

Make sure you wait for Expose events before drawing.  The DECwindows
window widget (created by your DwtWindow call) provides an Expose event
callback to simplify this for you.  Only by putting your drawing
function in the callback will the X toolkit maintain your drawing.  The
callback gives you the original Expose event, so your drawing function
can be as smart or dumb as you like.

Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee

converse@EXPO.LCS.MIT.EDU (Donna Converse) (02/10/90)

> I also defined a widget for drawing (lines, rectangles
> etc.) by using the DwtWindow call.  I get the screen, display, and
>  window from the XtScreen, XtDisplay, and XtWindow calls using
> the widget I defined for drawing as the argument for these calls.
> When I then use these returned values to XDrawLine the line will not
> appear on the display.

The error is probably that didn't know that you have to wait until you receive 
the first expose event on the drawing widget's window before you begin to draw.

converse@expo.lcs.mit.edu