Path: utzoo!attcan!uunet!husc6!bloom-beacon!TUB.BITNET!olaf From: olaf@TUB.BITNET (Olaf Heimburger) Newsgroups: comp.windows.x Subject: Widgets and Xlib Message-ID: <8901200605.AA29048@tub.UUCP> Date: 20 Jan 89 06:05:26 GMT References: <8901191816.AA01304@tub.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 59 > Date: Thu, 19 Jan 89 12:56:00 GMT > Reply-To: tub!xpert%ATHENA.MIT.EDU > Sender: XPERT distribution list > Comments: Warning -- original Sender: tag was xpert-request@ATHENA.MIT.EDU > From: tub!beckman%IUVAX.CS.INDIANA.EDU > Comments: To: xpert@athena.mit.edu > > > I am using the HP Widget set. How do I use the Xlib graphic primitives > within a widget to draw lines, boxes, etc. I haven't had any success. > I have tried lots of different things, the most recent being this: > > Display *dpy; > Drawable win; > GC gc; > > dpy = XtDisplay(widget) > win = XtWindow(widget); > gc = XtGetGC(widget); > > XDrawLine(dpy,win,gc,0,0,100,100); > > Could you please help me out? -Pete beckman@cs.iuvax.indiana.edu You use XtGetGC in the wrong way. Look in the X Intrinsics at section ``Sharing Graphics Contexts''. XtGetGC is defined as follows GC XtGetGC (w, value_mask, values) Widget w; XtGCMask value_mask; XGCValues *values; When you replace gc = XtGetGC (widget); with XGCValues Values; XtGCMask Mask; /* ... */ Values.foreground = widget->core.border_pixel; Values.background = widget->core.background_pixel; Mask = GCForeground | GCBackground; gc = XtGetGC (widget, Mask, &Values); it should work. Olaf ------------------------------------------------------------------------ It's for youhou. ------------------------------------------------------------------------ Olaf Heimburger, Technical University of Berlin (West), Department of Computer Science uucp to tub: ...!pyramid!tub!olaf (from the US, only) ...!mcvax!unido!tub!olaf (from Europe only) ------------------------------------------------------------------------