[comp.windows.x] Colors, Fonts, & Vararrrrggggghhhhhs!!!!

kkirksey@eng.auburn.edu (Kenneth B. Kirksey) (03/26/91)

	I know that I'm going to feel really stoopid when I find out the answer
to this one, but I'll ask anyway.  I'm having problems when I specify fonts
or colors in my XtVaCreateManagedWidget calls.  For example:

title_label	= XtVaCreateManagedWidget (
		"title_label",
		labelWidgetClass,
		base_win,
			XtNfont, "-*-helvetica-*-r-*-*-14-140-*-*-*-*-*-*",
			XtNlabel, "ASCII Chart",
			XtNwidth, 408,
			XtNbackground, "white",
		NULL);

makes the background black.  If I specify any other color, it still makes
it black.  If I specify a color for any of my widgets, it makes it black.
The colors work fine when I specify them in the app defaults file, as do
my font specifications.  The call above gives me a "bad font" error.
	I thought that when you specified values in the varargs list that they
would automatically be converted to the correct type.  Is this the case?
If not, how should I go about doing this.

			Thanx in advance,
				Ken


+---------------------------+------------------------------------------------+
| Ken Kirksey               | "I stay driven 'cause there's nowhere to park, |
|                           |  I can't shut my eyes, I'm afraid of the dark, |
| Computer Engineering      |  I lie awake, that stone left me chilled to    |
|                           | 		the bone,                            |
| Auburn University         |  Sound the alarm before it's done,             |
|                           |  Find Jim Morrison!"                           |
| kkirksey@eng.auburn.edu   |                             - Steve Taylor     |
+---------------------------+------------------------------------------------+

mgsmith@hplabs.hpl.hp.com (Michael Smith) (03/29/91)

>
>title_label	= XtVaCreateManagedWidget (
>		"title_label",
>		labelWidgetClass,
>		base_win,
>			XtNfont, "-*-helvetica-*-r-*-*-14-140-*-*-*-*-*-*",
>			XtNlabel, "ASCII Chart",
>			XtNwidth, 408,
>			XtNbackground, "white",
>		NULL);
>

Because the XtVa function call does not what type to convert from, it
doesn't know which converter to use. Therefore it is assumes that
the type is proper.  You were assigning the string "white" for the backgrouind
when it was expecting a pixel value.  You will hate me for this one but 
there is a way to do it but someone borrowed my documentation and hasn't
returned it yet.  It goes something like:

title_label	= XtVaCreateManagedWidget (
		"title_label",
		labelWidgetClass,
		base_win,
			XtNlabel, "ASCII Chart",
			XtNwidth, 408,
			XtNbackground, XtDoConversion, XmNpixel, XmNstring, "white",
		NULL);

Mail me something in a couiple of days and maybe I will have retrieved
the documentation by then.

Mike Smith
HP Labs