Top Document: Motif FAQ (Part 9 of 9) Previous Document: 307) Why can't I install my own colormap using XInstallColormap? Next Document: 309) How do I get correct shadow colors to match other color See reader questions & answers on this topic! - Help others by sharing your knowledge [Last modified: Jan 96] Answer: Mark Buser (buser@tartan.com) writes: If you find that your XAllocNamedColor is failing or XpmCreatePixmapFromData is dieing from XpmColorFaileds, you may have exhausted the number of colormap entries. One way to install a new colormap is the following: Toplevel = XtVaAppInitialize ( &app, ... dpy = XtDisplay (Toplevel); cmap = DefaultColormapOfScreen ( XtScreen( Toplevel) ); /* Detect color errors due to colormap depletion */ if (colors_depleted) { cmap = XCopyColormapAndFree ( dpy, cmap ); /* Run through color allocation again to see if ok now */ } /* Install colormap into toplevel widget. This must be done ** before any child widgets are created. */ XtVaSetValues ( Toplevel, XmNcolormap, cmap, NULL); /* Create any children of toplevel, they will inherit new colormap */ This is only one way to go, there are other possibilities, but this seems to be the simplest. User Contributions:Top Document: Motif FAQ (Part 9 of 9) Previous Document: 307) Why can't I install my own colormap using XInstallColormap? Next Document: 309) How do I get correct shadow colors to match other color Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: kenton@rahul.net (Ken Lee)
Last Update March 27 2014 @ 02:11 PM
|
Comment about this article, ask questions, or add new information about this topic: