[comp.sys.mac.programmer] Offscreen CWindows and Color Controls

omullarn@oracle.oracle.com (Oliver Mullarney) (02/12/90)

Hope someone can help me with this: I'm trying to draw a color control
into an offscreen window, and the use CopyBits to 'rubber-stamp' it onto the
screen.
I open a new CWindow and copy the color table from the destination window
into this one, as per Technote #120(?), whatever. Add a palette, just in
case the surrounding code is using the Palette Manager. Create a new PixMap
of the deepest depth available, as per the same Technote.
Create a new control and set up it's colour table (in this case a Checkbox,
with both foreground and background set to a shade of blue).
Set the background color of the offscreen window to that of the destination
window, and EraseRect its contents.
Size the control etc., then call ShowControl.
Set the foreground and background of the destination window to Black and White,
respectively, and copybits from the source window to the destination (as per
IM V5).
Restore destination window's fore and background colors ('cos I'm a good boy).

Problem is that the control appears in a white rectangle. That's not a problem,
says you. Well, it is: the background color of the destination window is a light
grey. All the 'real' controls appear on a light grey background, but all the
rubber-stamped ones appear on white.
I have looked at the offscreen pixmap after the EraseRect and before the
ShowControl - it is fine, filled with F5s, the index for the light grey. The
control's color table indicates says its colors are foreground & background
are both blue, but immediately after the call to ShowControl, the PixMap is
unnacountably filled with 00s (except for the foreground parts of the control,
which are the correct index for the shade of blue in the control color table).

Any Color/Pallete/OffScreen know-it-alls out there who can help?

Thanks

  Oliver


| Oliver Mullarney     |         "Death wears a big hat,                     |
| Oracle Corporation   |          'cos he's a big bloke"                     |
| omullarn@oracle.com  |                 Tokyo Storm Warning, Elvis Costello |
 --------------- "Universally acknowledged to work just fine" ----------------