• 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: Transparent window and opaque objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transparent window and opaque objects


  • Subject: Re: Transparent window and opaque objects
  • From: Andrew Merenbach <email@hidden>
  • Date: Wed, 24 Oct 2007 15:28:25 -0700

Hi, Lorenzo,

It sounds as though you've placed the text field views (overlapped) on the image view. See this post:

<http://lists.apple.com/archives/cocoa-dev/2007/Mar/msg00961.html>

To quote, it has a ref to Apple's docs, that says:

"Note: For performance reasons, Cocoa does not enforce clipping among sibling views or guarantee correct invalidation and drawing behavior when sibling views overlap. If you want a view to be drawn in front of another view, you should make the front view a subview (or descendant) of the rear view."

Additionally, the poster (Michael Watson) says:

There are things in IB and NSView that appear to be planning for future additions, but in the end, the documentation says not to overlap views.

So we may (I have no knowledge about this) see something new in Leopard, or we may not. Time will tell.


As for your issue, you may wish to try to draw the text onto the image that you're trying to display, rather than placing text fields above the image.

If we knew more about what you were trying to do (maybe a diagram or screenshot?), maybe a more dynamic (as in, for updating the text) solution could be conceived.

Best,
    Andrew

On Oct 24, 2007, at 3:14 PM, Lorenzo wrote:

Hi,
I set my window with a transparent background

    [win setBackgroundColor:[NSColor clearColor]];
    [win setOpaque:NO];
    [win setHasShadow:NO];
    [[win contentView] addSubview:aView];

The aView contains an NSImageView and some white NSTextField labels.
The NSImageView contains a rounded corner rectangle gray image with alpha
0.5. My intention is to see an half a transparent rounded corner pop-up
window with some pure-white text over.
In IB I can quite see the half-transparent picture within the NSImageView,
and the white text OVER the image. Instead when I launch the application,
the white text gets multiplied (I guess) by the image alpha value and
results in a dark gray color. What did I forget? Any idea?



Best Regards -- Lorenzo email: email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
40ucla.edu


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Transparent window and opaque objects (From: Lorenzo <email@hidden>)

  • Prev by Date: Re: Transparent window and opaque objects
  • Next by Date: Activating Quit Menu with a Modal Window
  • Previous by thread: Re: Transparent window and opaque objects
  • Next by thread: Re: Transparent window and opaque objects
  • Index(es):
    • Date
    • Thread