Is there any way I could dim my NSWindow (basically putting a black transparent layer over top of it that you cannot click through) and then layer a custom NSView on top?
+1
A:
You could create an additional NSView which contains your custom NSView. This new NSView would simply draw the black transparent layer in its drawRect and capture all events to avoid them being passed through to the window.
nall
2009-09-27 18:58:36
I have this method working fully right now, only one thing I need to know. How do I capture all events?
macatomy
2009-09-28 01:00:19
A great discussion of the basics of NSView event handling is here: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/EventOverview/EventHandlingBasics/EventHandlingBasics.html
nall
2009-09-29 18:14:31
+2
A:
A more compartmentalized way would be to make a borderless window containing the black view and the custom NSView, and make that a child window of the window you want to “dim”. Then use NSViewAnimation to fade the window in and out.
You will, of course, need to handle keeping their sizes matched if the “dimmed” window is resizable.
Peter Hosey
2009-09-27 19:07:48
+1
A:
You could just set the background color of your NSWindow the black and change the opacity to your liking.
Andrew Johnson
2009-09-27 19:11:24
Tried this and it works, but I need to put stuff on the transparent view so I decided to go with a separate NSView.
macatomy
2009-09-28 00:59:34