• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Window transparency
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Window transparency


  • Subject: Re: Window transparency
  • From: Rob Abernathy <email@hidden>
  • Date: Thu, 5 Feb 2004 09:59:49 +0000

Since I joined this list to have this very question answered, I guess I'll answer.

You need to put a custom view in your window where you want the transparency. Then for the window that you are going to want the transparent part you need

- (void)windowControllerDidLoadNib:(NSWindowController *) aController {
....

[documentWindow setAlphaValue:0.999f];
[documentWindow setOpaque: NO]; // Not sure this is needed

....
}

or something equivalent.

Then in the drawRect for your view you need to:

-(void) drawRect:(NSRect)frame {

...
//Clear the background
[[NSColor clearColor] set];
NSRectFill([self frame]);

...
}

Then draw whatever you want to be transparent at the transparency you want.

Rob



On 4 Feb 2004, at 11:19 pm, Johan Kool wrote:

Hello,

I'd like to make my window's background transparent but keep the drawing in it at full opaqueness. Also the titlebar and resize widget I'd like to keep in the normal state. The only thing I could find now was [myWindow setAlphaValue:float]. The problem is that this alphavalue will be used for my entire window, so that my view, titlebar and everything is transparent too.

Terminal.app can do what I want, so I should be able to do so too. Any pointers, clues?

Thanks again!

Johan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Window transparency
      • From: Rob Abernathy <email@hidden>
References: 
 >Window transparency (From: Johan Kool <email@hidden>)

  • Prev by Date: Re: Window transparency
  • Next by Date: Re: Window transparency
  • Previous by thread: Re: Window transparency
  • Next by thread: Re: Window transparency
  • Index(es):
    • Date
    • Thread