[comp.sys.mac.programmer] Color Quickdraw and RBGBackColor

fxcmh@acad3.alaska.edu (05/21/91)

Easy (I hope) color quickdraw question.  I set the RGBBackColor to
anything besides white, and do some EraseRect calls, among other
things.  Then, within the application, everything works fine.  I
change the RGBBBackColor (sp?) back to white, and everything still
works fine, until the application quits.  Then, unfortunately, things
quit working.  The background color for a lot of the windows from
other applications turns black.  For instance, the buttons in any
dialog box that comes up after I quit my application are entirely
black.  This makes it tough to read them!  Anyway, the question is,
what am I doing wrong? I am sure it is the RGBBackColor call, because
if I change them all to RGBForeColor and change the EraseRect to
FillRect, everything works fine.  I am not willing to leave it like
this because what I am doing is really the background of the window.
-------------------------------------------------------------------------------
| Chris Hartman; Academic Computing; University of AK, Fairbanks.             |
| INTERNET: fxcmh@acad3.alaska.edu; BITNET: FXCMH@ALASKA; SNAIL PO Box 901073 |
| *** Nobody ever said being a math major was FUN! ***        Fbnks, AK 99775 |
-------------------------------------------------------------------------------

ags@seaman.cc.purdue.edu (Dave Seaman) (05/22/91)

In article <1991May20.163218.1@acad3.alaska.edu> fxcmh@acad3.alaska.edu writes:
>Easy (I hope) color quickdraw question.  I set the RGBBackColor to
>anything besides white, and do some EraseRect calls, among other
>things.  Then, within the application, everything works fine.  I
>change the RGBBBackColor (sp?) back to white, and everything still
>works fine, until the application quits.  Then, unfortunately, things
>quit working.  The background color for a lot of the windows from
>other applications turns black.  For instance, the buttons in any
>dialog box that comes up after I quit my application are entirely
>black.  This makes it tough to read them!  Anyway, the question is,
>what am I doing wrong? I am sure it is the RGBBackColor call, because
>if I change them all to RGBForeColor and change the EraseRect to
>FillRect, everything works fine.  I am not willing to leave it like
>this because what I am doing is really the background of the window.

Are you doing the proper SetPort before calling RGBBackColor?  From your
description, it sounds as if you have set your desktop background color to
black, instead of the window background color.  You wouldn't notice the
difference until an update occurs outside the window.

If you want that one particular window always to have a black background, and
if you are using GetNewCWindow to create it, there is an even easier way.
Create a 'wctb' resource having the same resource ID as your 'WIND' resource,
and set the content color to black in the 'wctb' resource.  The window will
come up black as soon as you open it, with no need for any RGBBackColor or
EraseRect calls.

--
Dave Seaman
ags@seaman.cc.purdue.edu

osborn@ux1.lbl.gov (James R Osborn) (05/22/91)

In article <12582@mentor.cc.purdue.edu> ags@seaman.cc.purdue.edu (Dave Seaman) writes:
>In article <1991May20.163218.1@acad3.alaska.edu> fxcmh@acad3.alaska.edu writes:
>>Easy (I hope) color quickdraw question.  I set the RGBBackColor to
>
> [lots of stuff deleted]
>
>If you want that one particular window always to have a black background, and
>if you are using GetNewCWindow to create it, there is an even easier way.
>Create a 'wctb' resource having the same resource ID as your 'WIND' resource,
>and set the content color to black in the 'wctb' resource.  The window will
>come up black as soon as you open it, with no need for any RGBBackColor or
>EraseRect calls.
>
>--
>Dave Seaman
>ags@seaman.cc.purdue.edu

You can also do a simlar thing as Dave is suggesting with dialogs
and alerts.  If you have a 'dctb' resource with the same ID as a
'DLOG', then GetNewDialog will open color dialog window (on a color
machine) that has the default colors specified in the 'dctb'.  A
similar situation occurs for 'actb' resources matching 'ALRT'
resources when you call Alert (NoteAlert, etc.) on a color machine.
The entries in the 'dctb' and 'actb' resource are identical to the
'wctb' format described in IM volume V - Window Manager chapter.

-- James

.------------------------------.--------------------------------------.
| James R. Osborn              | It just goes to show you it's always |
| Lawrence Berkeley Laboratory | something.  Either it's unclear tech |
| osborn@ux1.lbl.gov           | notes or your mac is smoking.  It's  |
| (415) 548-8464               | always something...                  |
'------------------------------'--------------------------------------'