wayne@chiton.ucsd.edu (Wayne Crawford) (06/28/91)
I've been attempting to write my first X program using the Athena widget set (for portability). Everything was going along fine until I tried to create a widget to draw to. I was using a Label widget and trying to create a bitmap (I know, depth=1) using XCreatePixmap, and then using XSetArg and XSetValues to load the info into the Label widget's resource. I was a bit confused as to what to specify as the window in XCreatePixmap; I've tried both the LAbel widget itself, and an independent window I created using XCreateSimpleWindow. No matter, in both cases as soon as I tried to load the bitmap into the Label widget's bitmap resource, i got the following message: X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 1 (X_CreateWindow) Minor opcode of failed request: 0 Resource id in failed request: 0x72610 Serial number of failed request: 46 Current serial number in output stream: 48 What? Help? I'd really like to know how to make this work. I'd especially like to know of a solution that doesn't require me to resize the bitmap everytime the aplication is resized. I'd be especially overjoyed to learn where I can get a sample Athena Toolkit program that does the right thing. Thanks, Wayne Crawford
ejk@ux2.cso.uiuc.edu (Ed Kubaitis - CSO ) (06/28/91)
|What? Help? I'd really like to know how to make this work. I'd |especially like to know of a solution that doesn't require me to |resize the bitmap everytime the aplication is resized. I'd be |especially overjoyed to learn where I can get a sample Athena Toolkit |program that does the right thing. Don't know if it's the right thing for what you want to do, but you might take a look at the gnuplot_x11 X graphics "backend" to the gnuplot interactive plotting program. It uses the Athena (or Motif) Label widget for its graphics, scales on the fly from 4000x4000 gnuplot coordinates to the current window geometry and does color as well as monochrome. Available from cs.duke.edu in pub/gnuplot/gnuplot2.02.tar.Z ---------------------------------- Ed Kubaitis (ejk@ux2.cso.uiuc.edu) Computing Services Office - University of Illinois, Urbana
holtt@rs6000.oce.orst.edu (Tim Holt) (06/28/91)
In article <1131@chiton.ucsd.edu> wayne@mpl%ucsd.edu (Wayne Crawford) writes: Stuff about bitmaps in labels and "window" for XCreatePixmap... >X Error of failed request: BadWindow (invalid Window parameter) > Major opcode of failed request: 1 (X_CreateWindow) > Minor opcode of failed request: 0 > Resource id in failed request: 0x72610 > Serial number of failed request: 46 > Current serial number in output stream: 48 I had a similar problem, setting up a bitmap label from a "bitmap" (the program) created bitmap data file. I did something like this... Display *display; int screen; Widget label; Pixmap bitmap; Arg arg[1]; int n; display = XtDisplay (partent_widget); screen = DefaultScreen (display); bitmap = XCreateBitmapFromData (display, RootWindow(display,screen), thebitmap_bits, thebitmap_width, thebitmap_height); n = 0; XtSetArg (arg[n], XtNbitmap, bitmap); n++; label = XtCreateManagedWidget ("icon", labelWidgetClass, parent_widget, arg, n); Did the trick for me, as far as that pesky error message was concerned... Tim Holt / Marine Tech. / RV Wecoma (RV = Research Vessel, not Recreational Vehicle!) / Oceanography / Oregon State University / holtt@rs6000.oce.orst.edu