[comp.windows.x] Question on using XmuCvtStringToBitmap converter

jason@tfs.COM (Jason P. Venner) (06/08/91)

I tried arranging a call of the form

  XtConvertArgRec	arg[1]
  Screen	*screen;
  Widget	tmp;

  screen = XtScreen(tmp);
  arg[0].address_mode = XtImmediate;
  arg[0].address_id = &screen;
  arg[0].size = sizeof(Sceen**);
  XtSetTypeConverter( XtRString, XtRBitmap, XmuCvtStringToBitmap,
  		args, 1, XtCacheNone, (XtDestructor) NULL );

I tried various address_mode's, and the results varied from
a core dump, to 
	Error: String to pixmap conversion needs screen argument

Jason.


  

asente@adobe.com (Paul Asente) (06/11/91)

In article <9106071800.AA22343@teccb1.TFS> jason@tfs.COM (Jason P. Venner) writes:
>
>
>I tried arranging a call of the form
>
>  XtConvertArgRec	arg[1]
>  Screen	*screen;
>  Widget	tmp;
>
>  screen = XtScreen(tmp);
>  arg[0].address_mode = XtImmediate;
>  arg[0].address_id = &screen;
>  arg[0].size = sizeof(Sceen**);
>  XtSetTypeConverter( XtRString, XtRBitmap, XmuCvtStringToBitmap,
>  		args, 1, XtCacheNone, (XtDestructor) NULL );
>
>I tried various address_mode's, and the results varied from
>a core dump, to 
>	Error: String to pixmap conversion needs screen argument

Try

static XtConvertArgRec screenConvertArg[] = {
    {XtWidgetBaseOffset, (caddr_t) XtOffset(Widget, core.screen),
	sizeof(Screen *)}
};

XtSetTypeConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap,
		   screenConvertArg, 1, XtCacheNone, (XtDestructor) NULL);

You want the converter to use the string from the widget that you are
converting for.

	-paul asente
		asente@adobe.com	...decwrl!adobe!asente

    Ratz put a bucket of liquid in front of me.
   "I wanted a glass of docs, Ratz.  What the hell is this?" I barked.
   "Motif don't fit in a glass anymore," he barked back.
    I looked at the liquid.  It was totally opaque to me.