0

I have a NSView inside a NSWindow and the background of NSWindow is set to black (with alpha of 0.7). Is there anyway to have the NSView showing what's underneath the NSWindow? In other words, how do I make the part where NSWindow and NSView overlap to have clear background?

Thanks!

revolver
  • 2,385
  • 5
  • 24
  • 40
  • So what do you want to see in the overlapped area? The black ground colour of the NSWindow? – Anthony Kong Feb 04 '14 at 16:36
  • Basically the desktop area behind NSWindow. I want that part of NSWindow to have a clear background too. – revolver Feb 04 '14 at 16:37
  • It is the confusing part: if you says 'desktop area' behind NSWindow, do you mean you want to see the part of desktop wallpaper covered by NSWindow? – Anthony Kong Feb 04 '14 at 16:50
  • Yes. You are right. I want to see the desktop wallpaper covered by NSWindow at the location where NSView is. – revolver Feb 04 '14 at 16:57

2 Answers2

0

You can try the setOpaque method

Anthony Kong
  • 37,791
  • 46
  • 172
  • 304
0

If I understand properly, it seems like you're trying to have a window with hole in it. You can take a look at apple's sample code Round Transparent Window. It shows how to add transparent areas to an NSWindow.

Merlevede
  • 8,140
  • 1
  • 24
  • 39