Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!think.com!linus!linus!mir!dsr From: dsr@mir.mitre.org (Douglas S. Rand) Newsgroups: comp.windows.x Subject: Re: Colormap with widgets Keywords: Xt,widgets,colormaps Message-ID: <1991Jan18.160846.16581@linus.mitre.org> Date: 18 Jan 91 16:08:46 GMT References: <1991Jan17.173335.2260@uokmax.ecn.uoknor.edu> Sender: news@linus.mitre.org (Linus's News) Reply-To: dsr@mir.mitre.org (Douglas S. Rand) Organization: The MITRE Corporation Lines: 35 Nntp-Posting-Host: mir.mitre.org In article <1991Jan17.173335.2260@uokmax.ecn.uoknor.edu>, jigang@alliant.backbone.uoknor.edu (Jigang Yang) writes: > > I got problem about using colormaps with widgets. > > I first use : XCreateColormap() to create a new colormap and read all colors > from default colormap and save them into new colormap. > > Then XInstallColormap(); > > Then create some widgets and attach them with some callbacks; > > Then the mainloop. > > > In some callbacks, I change the RGB values of the new colormap(since it is > installed, it should be the current colormap), and install it again. > > But I only see the widgets using the newly changed color when they are focused. > For example, if you focus / click the button, the colormap is changed, > and then it seems to use the original colormap again! Why!!! > Because when you install a colormap in a Window (remember all your Widgets are X Windows) the colormap only becomes visible when that window is in focus. How else could it work on a display with only one active colormap? (I am presuming a PseudoColor visual and one active colormap at a time) This is what colormaps are for. If you want the button, or whatever, to always be colored a certain way you must use the default colormap. -- Douglas S. Rand Internet: Snail: MITRE, Burlington Road, Bedford, MA Disclaimer: MITRE might agree with me - then again... Amateur Radio: KC1KJ