bmcprog@MYCROFT.MAYO.EDU (03/03/90)
I am trying to use a bitmap instead of a label in a command widget. I had assumed that one could set the bitmap in the same manner as a label so I used: num_args = 0; no_obj = XCreateBitmapFromData (XtDisplay(parent), DefaultRootWindow (XtDisplay(parent)), no_obj_bits, no_obj_width, no_obj_height); XtSetArg (args[num_args], XtNbitmap, no_obj); num_args++; m_obj = XtCreateManagedWidget ("object", commandWidgetClass, parent, args, num_args); XFreePixmap (XtDisplay(parent), no_obj); As the code to set and create the widget. When I run a test of this code, I get: X Error of failed request: BadDrawable (invalid Pixmap or Window parameter) Major opcode of failed request: 63 (X_CopyPlane) Minor opcode of failed request: 0 Resource id in failed request: 0x1000019 Serial number of failed request: 102 Current serial number in output stream: 107 Question: What is the correct way to set a bitmap in a command widget? I'd RTFM, but my copy of Athena Widget Set - C Language Interface (X11R4) says: "See Converting Bitmaps for details), yet I can't find Converting Bitmaps any where in the manual. If it makes a difference, I'm running X11R4 (fixes 1, 2) on a DECstation 3100 under Ultrix 3.1. As always, many thanks in advance. --Bruce ---------------------------------------------------- Bruce M. Cameron bmc@bru.mayo.edu Medical Sciences 1-14 (507) 284-3288 Mayo Foundation WD9CKW Rochester, MN 55905 ----------------------------------------------------
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (03/03/90)
> I am trying to use a bitmap instead of a label in a command widget. I had > assumed that one could set the bitmap in the same manner as a label so I used: > num_args = 0; > no_obj = XCreateBitmapFromData (XtDisplay(parent), > DefaultRootWindow (XtDisplay(parent)), > no_obj_bits, no_obj_width, no_obj_height); > XtSetArg (args[num_args], XtNbitmap, no_obj); > num_args++; > m_obj = XtCreateManagedWidget ("object", commandWidgetClass, parent, args, > num_args); This is fine. > XFreePixmap (XtDisplay(parent), no_obj); Don't free the pixmap, the label widget needs it. Add a destroy callback to the label widget that will free the pixmap when the label widget is destroyed. > I'd RTFM, but my copy of Athena Widget Set - C Language Interface (X11R4) > says: "See Converting Bitmaps for details), yet I can't find Converting Bitmaps > any where in the manual. Converting Bixmaps is section 2.4.3 (it's actually called Bitmap Conversion) sorry for the mixup. Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213