[comp.sys.mac.programmer] Color table/palette problem

mcli@joker.cc.rochester.edu (Maurice Ling) (02/15/91)

Hi everyone,

In the program that I'm writing, I am setting the clut so that it has
256 color or gray scale entries.  I have a window with the entire clut
displayed on it, one color per line from top to bottom, so, for gray
scales, at the top I have white, and it gradually turns to black as
you go down the window.  I also have another color window with tools
in it.  

When I create my windows, I use SetPalette (myWindow, mypalettehandle,
false);  with mypalettehandle = NewPalette(256,nil, pmExplicit, 0);

The problem comes, when I call SFPGetFile, and the dialog box comes
up, about 4 or 5 of the color table values get changed, so I have 4 or
5 monochromatic lines of color going across my "clut" window, with the
rest of the gray scale lines the same as before.  After I load in my
image into a offscreen pixel map (with the same clut), and copy it
into the window, You can see that there are a few pixels which are in
color, while the rest of the image is gray scale.  However, if I set
my color table again, (using set entries and loading the clut again)
the image is normal, ie, no color pixels in it, and same with the
"clut" window.

Somehow, the dialog box for the file selector is loading in a
different color palette, and messing up my program's palette.  A
similar effect can be obtained if I change applications on
multifinder.  However, I am able to restore the clut when multifinder
returns to my application.  An easy way out is to just set the color
table again after calling SFPGetFile, but I don't want to do that
every time I call a dialog.  

Does anyone know a proper way to prevent the dialog box from changing
the color palette?  Please reply by mail (if you can reach my site) 
and I will summarize.

Thanks a lot,

Maurice

* ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * **
                                                \/
                                               >--< ======================
Internet:  mcli@joker.optics.rochester.edu      /\