po@cs.utexas.edu (Po Ling Cheung) (12/10/88)
I have problems displaying a bitmap file using the XtNbitmap resource
in a label widget.
First I tried specifying a file name but I got an X Protocol error:
toplevel = XtInitialize( NULL, "DEmo", NULL, 0, &argc, argv);
XtSetArg(args[0], XtNbitmap, "/usr/include/X11/bitmaps/xlogo16");
xlogo = XtCreateManagedWidget("xlogo", labelWidgetClass, toplevel,
args, 1);
XtRealizeWidget(toplevel);
XtMainLoop();
X Protocol error: BadDrawable, invalid Pixmap or Window parameter
Major opcode of failed request: 14 (X_GetGeometry)
Minor opcode of failed request: 0
Resource id in failed request: 0x25c3c
Serial number of failed request: 14
Current serial number in output stream: 14
Next I tried creating the pixmap by replacing the XtSetArg call with:
#include <X11/bitmaps/xlogo16>
dpy = XtDisplay(toplevel);
XtSetArg(args[0], XtNbitmap, XCreateBitmapFromData (dpy,
DefaultRootWindow(dpy), xlogo16_bits, xlogo16_width, xlogo16_height));
The label widget shows up but the contents is some colored garbage
instead of the xlogo I want.
Eventually, I want to be able to display my own bitmap file on a
label widget.
What am I doing wrong?
Could someone please give me some hints?
Thanks,
Po Cheung ... po@cs.utexas.edu