• 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: complex problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: complex problem


  • Subject: Re: complex problem
  • From: email@hidden
  • Date: Mon, 25 Feb 2002 11:48:13 -0800

[A more descriptive subject might be nice, by the way :->]

I have the following problem: I want to be able to force an NSView and all of its subviews to be semi-transparent. However, unfortunately there is no setAlphaValue. My goal is to have an NSView that is semi-transparent and when the mouse gets over it, it gets fully opaque. I know I need to subclass NSView, but where do I go next?

First, override -isOpaque to return NO if necessary. (The doc claims that NSView itself returns NO, so you should only have to do this if you're subclassing some other NSView subclass that itself overrode isOpaque to return YES).
Second, in drawRect:, draw with NSColors that have some degree of alpha transparency in them. You will be drawing on top of your ancestor view's bits in your window buffer.
Third, note that overlapping siblings views are not correctly handled by the NSView drawing machinery, so don't expect overlapping sibling views to work. If that's disappointing to you, please log a bug. :->
Good luck!

Ben Haller
Stick Software
_______________________________________________
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.

  • Prev by Date: Re: Overriding NSTextField problem
  • Next by Date: Re: application quit right after launching
  • Previous by thread: complex problem
  • Next by thread: Converting from NSURL to CFURLRef
  • Index(es):
    • Date
    • Thread