NSWindow's setBackgroundColor: method problem
NSWindow's setBackgroundColor: method problem
- Subject: NSWindow's setBackgroundColor: method problem
- From: Andrew Madsen <email@hidden>
- Date: Mon, 3 Jul 2006 16:04:27 -0600
I'm seeing something I don't understand with the setBackgroundColor:
method of NSWindow. I'm writing a document-based app. In the
windowControllerDidLoadNib: method of MyDocument.m I set the
background color of the window to the color I want and everything is
fine. I want it to switch to another color when it's not the key
window. So, I register MyDocument for the
NSWindowDidResignKeyNotification and NSWindowDidBecomeKeyNotification
in order to change the window background color when the window
switches between being key and not key. In the the methods
registered with the notification center, I have exactly one line (in
each):
[docWindow setBackgroundColor: [NSColor redColor]]; //For when the
window is key
[docWindow setBackgroundColor: [NSColor greenColor]]; //For when the
window is not key
(I'm not really planning on using red and green, they just make it
really easy to see what's going on.)
What I don't understand is that the window comes up red just like I'd
expect when I open the app or create a new document. However, when I
click on another window, thus making the document window resign its
key status, only a small portion of the window turns green. The area
around whatever element of the window (search field, text field, etc)
is active turns green, but the rest of the window stays red. I can't
figure out why the [docWindow setBackgroundColor:] method call
doesn't seem to affect the whole window. Can anyone shed some light
on this?
Thanks!
Andrew Madsen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden