[comp.windows.x] XtSetArg for Setting colour to widget?

gteo@swift.cs.tcd.ie (11/02/90)

Hello,
	This may be a very trivial question to ask, but it has blotted me
for a lot time. When I try to set the background or foreground colour for
a widget, for example, a label using the following,

	XtSetArg(arg[i],XtNbackground, "blue"); i++;
	...
	XtSetValues(label, arg,i);

or in Motif

	XtSetArg(arg[i],XmNbackground, "blue"); i++;
	...
	XtSetValues(label, arg,i);

	The background colour of the label widget just doesn't seem to be
set to the colour stated, in this case, "blue".
	What do I have to do to make this to work?
Thanks,

Ghee Teo

asente@adobe.com (Paul Asente) (11/02/90)

In article <7246.27309166@swift.cs.tcd.ie> gteo@swift.cs.tcd.ie writes:
>When I try to set the background or foreground colour for
>a widget, for example, a label using the following,
>
>	XtSetArg(arg[i],XtNbackground, "blue"); i++;
>	...
>	XtSetValues(label, arg,i);

The XtNbackground resource takes a Pixel value, not a string.  Either
invoke a type converter to convert the string to a pixel value (i.e.
XtConvertAndStore in R4, XtConvert in R3) or use the new varargs interface
XtVaSetValues and use an XtVaTypedArg.

My recently-published book has an extensive section on this.  I recommend
it highly :-).

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