Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSTextView 0% opaque = black ?

NSTextView 0% opaque = black ?
Thread Tools
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Dec 15, 2002, 08:29 PM
 
I guess I just don't understand how NSTextView's are supposed to be configured for opacity with Interface Builder.

By default, they are 100% opaque. You can change the opacity of the background to whatever you want, so I've changed the opacity to 0% (ie, totally transparent, or so I thought). However, this just makes it entirely black (at run time, not in interface builder).

What am I doing wrong? How do I make my NSTextView transparent?
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Dec 15, 2002, 09:50 PM
 
well I've tried passing the NSTextView the message:

setBackgroundColor:[NSColor clearColor]

and I've tried passing the same message to it's enclosingScrollView, and tried doing both, but I'm still just getting a black rectange for the NSTextView, even though the object(s) behind it are all white.

Any ideas anyone?
     
Junior Member
Join Date: Dec 2000
Location: Boston, MA USA
Status: Offline
Reply With Quote
Dec 15, 2002, 11:40 PM
 
Originally posted by Brass:
What am I doing wrong? How do I make my NSTextView transparent?
Most likely it is black because the NSTextView class tells the Quartz engine that it is opaque, and that nothing can show through it. You indicate this to Quartz by return YES from the function -(BOOL)isOpaque in the class. This is used to speed up drawing elements that are solid (as Quartz will not bother to draw anything below it).

The solution would be to create a subclass of NSTextView (say NSTransparentTextView) override the isOpaque method to return NO, and use this class in place of the regular TextView class.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:57 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2