Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!xanth!nic.MR.NET!umn-cs!randy From: randy@umn-cs.CS.UMN.EDU (Randy Orrison) Newsgroups: comp.windows.x Subject: How do I draw on a widget? Keywords: novice excuse ignorance Message-ID: <10461@umn-cs.CS.UMN.EDU> Date: 16 Dec 88 03:36:12 GMT Reply-To: randy@umn-cs.cs.umn.edu (Randy Orrison) Organization: Chemical Computer Thinking Battery, St. Paul, MN Lines: 53 What kind of Widget should I use to draw on, and how do I do it? I'm currently trying to use a staticraster widget, and am getting the display and window with the XtDisplay and XtWindow calls, but when I call XDrawRectangle I get an X Error: parameter not a Pixmap or Window. The thing that bothers me is that this error does not occur at the time of the XDrawRectangle call, but later. I don't know when, really. I'm sure that this info is useful in some way: | X Error: parameter not a Pixmap or Window | Request Major code 67 | Request Minor code | ResourceID 0x0 | Error Serial #41 | Current Serial #56 but it doesn't help me any. Here's the code that creates the widget: | XtSetArg (arg[0], XtNheight, (XtArgVal) HEIGHT); | XtSetArg (arg[1], XtNwidth, (XtArgVal) WIDTH); | XtSetArg (arg[2], XtNsRimage, (XtArgVal) NULL); | fu = XtCreateManagedWidget ("box", XwsrasterWidgetClass, | rgber, arg, 3); and here's the code that trys to draw on it: |void |putbox (wid, x, y) | Widget wid; | int x, y; |{ | Window drawwin = XtWindow (wid); | Display *dpy = XtDisplay (wid); | XGCValues gcv; | GC gc; | | gcv.foreground = BlackPixel (dpy, DefaultScreen (dpy)); | gcv.background = WhitePixel (dpy, DefaultScreen (dpy)); | gc = XtGetGC (wid, (GCForeground | GCBackground), &gcv); | | XDrawRectangle (dpy, drawwin, gc, x-2, y-2, 5, 5); |} The routine putbox is called with 'fu' from the bit of code above that creates the widget. What am I doing wrong? Please take into account that I have no idea what I'm doing anyway... Thanks for any and all help! -randy -- Randy Orrison, Chemical Computer Thinking Battery -- randy@cctb.mn.org (aka randy@{ux.acss.umn.edu, umn-cs.uucp, umnacca.bitnet, halcdc.uucp}) Lie: A very poor substitute for the truth, but the only one discovered to date.