Re: XForms: colormaps and canvases

Jorgen Bjornstrup (jorgen@vision.auc.dk)
Wed, 22 Oct 1997 20:56:17 GMT

To subscribers of the xforms list from jorgen@vision.auc.dk (Jorgen Bjornstrup) :

Hi,

>>>>> "Stephen" == Stephen Langer <langer@cam.nist.gov> writes:

> To subscribers of the xforms list from "Stephen Langer"
> <langer@cam.nist.gov> : I asked:
>>> Is it possible to install a colormap in more than one canvas?

> spl replied:
>> It's probably better to either use the Default map or to just copy
>> one colormap to the other than trying to use two.

> I can't use the default map since I need to know that I can fill the
> colormap with lots of colors. (I don't mind if there's a bit of
> flashing when the window focus changes.) The colormap that I use isn't
> static -- I have to be able to change entries in it -- so it would be
> nice to have only ONE map so that I don't have to make the changes
> twice. But when I install one map in two canvases, the program crashes
> when the form is freed.

I am no an XForms expert and probably not even an X11 expert, so this
might not be the correct/best/easiest way to do it, but ...

First a question. Since you want to have identical colormaps in two
canvases in the same window, then why do you not just use the same
colormap for both canvases, i.e., by setting the colormap for the window
containing the canvases?

This can probably be done through the XForms API, but when I need to
have my own colormap (so that I can modify it freely) for a canvas, then
I bypass the XForms API (using FL_ObjWin to get the X window ID) and set
the colormap using X commands like XCreateColormap, XStoreColors, and
XSetWindowColormap to get the colormap I want. A drawback of setting
the colormap for the entire window is that the window colormap, of
course, also is used by the other objects in the form, so you might have
to use non-standard color-indexes for these objects in order to get the
colors you want, depending on how you set the entries in the colormap.

I hope that this can help you.

-- 
\jorgen

-------------------------------------------------------------------------- Jorgen Bjornstrup, M.Sc.C.E., PhD-stud | E-mail: jorgen@nada.kth.se Computational Vision and Active | /( | WWW: Perception Group (CVAP), NADA | ._//( | http://www.vision.auc.dk/~jorgen Kungl Tekniska Hvgskolan (KTH) | / | \ | PGP: ~jorgen/pgp.html Fiskartorpsvdgen 15, room 13.02 | Visiting | Phone: +46-8-790-6138 S-100 44 Stockholm, Sweden | from AUC | Fax: +46-8-723-0302 -------------------------------------------------------------------------- _________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuf2.usuhs.mil or see http://bob.usuf2.usuhs.mil/mailserv/xforms.html Xforms Home Page: http://bragg.phys.uwm.edu/xforms List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/