Path: utzoo!utgpu!watmath!att!ucbvax!tut.cis.ohio-state.edu!bloom-beacon!EXPO.LCS.MIT.EDU!kit From: kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: X Toolkit color problem Message-ID: <8908171643.AA23330@expo.lcs.mit.edu> Date: 17 Aug 89 16:43:04 GMT References: <3112@bucsb.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 36 When using XtSetArg you must pass in the correct pixel value, not the name of the color. You will have to get the pixel value yourself. Here is one way to get that pixel value from a string. Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213 ---------------------------------------------------------------- /* Function Name: ConvertColor * Description: This converts a string into a color. * Arguments: color_name - name of the color. * Returns: a pixel value for that color. */ static Pixel ConvertColor(w, color_name) Widget w; char * color_name; { XrmValue from, to; from.size = sizeof(color_name); from.addr = color_name; XtConvert(w, XtRString, (XrmValuePtr) &from, XtRPixel, (XrmValuePtr) &to); if (to.addr == NULL) exit(1); return( (Pixel) *(to.addr) ); }