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 Transparent = Black ?

NSTextView Transparent = Black ?
Thread Tools
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Mar 1, 2005, 11:58 PM
 
I'd like to make some NSTextViews transparent, so that I can see what's on the other NSTextViews behind them. However, setting them to 0% opacity in Interface Builder just makes them completely black when I run the application.

I'm guessing there is some view layer somewhere that I'm not aware of that is black and 100% opaque?

What is going on here, and how to I make my NSTextViews transparent without making them black?

(BTW, these NSTextViews are NOT within NSScrollViews).
     
Arclite
Junior Member
Join Date: Sep 2003
Location: Nowhere, Missouri
Status: Offline
Reply With Quote
Mar 2, 2005, 04:32 PM
 
Code:
[[textView enclosingScrollView] setDrawsBackground:NO]; [textView setDrawsBackground:NO];
That's the code I have. I know you said you didn't have a scroll view, but I believe that this also affects other view layers. I'd give it a shot, at least.
     
Devin Lane
Forum Regular
Join Date: Aug 2003
Status: Offline
Reply With Quote
Mar 2, 2005, 07:54 PM
 
Question: What, exactly, is the use for a text view without a scroll view and why are you using them? If you want one line unformatted input, simply use an NSTextField.
-- Devin Lane, Cocoa Programmer
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Mar 2, 2005, 08:12 PM
 
Originally posted by Devin Lane:
Question: What, exactly, is the use for a text view without a scroll view and why are you using them? If you want one line unformatted input, simply use an NSTextField.
There are plenty of uses for text views without scroll views! I mainly use them for printing, where a scroll view is an unnecessary additional level of complication that just gets in the way (eg, [[[... enclosingScrollView] superview] superview]).

If you can guarentee that your NSTextView is of a fixed size that never needs to be scrolled, then why on earth would you want to put it in an NSScrollView? Yes, there are some situations where this is the case. I've come across plenty.

An NSTextField is not so versatile as an NSTextView, and is better suited, as you've said, to a single line of unformatted input.
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Mar 2, 2005, 08:17 PM
 
How did you create an NSTextView without a scroll view in IB? I don't see a palette for it anywhere.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Arclite
Junior Member
Join Date: Sep 2003
Location: Nowhere, Missouri
Status: Offline
Reply With Quote
Mar 2, 2005, 08:26 PM
 
He probably created it programatically. However, I believe you can use a custom view and set the class (using the inspector) to NSTextView. I haven't tried it, though.
     
Brass  (op)
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Mar 2, 2005, 08:32 PM
 
Originally posted by Chuckit:
How did you create an NSTextView without a scroll view in IB? I don't see a palette for it anywhere.
You simply add a generic NSView, and set it's class to be NSTextView. Of course this makes it impossible to do much else with it in IB. Which leads me on to a bit of a problem with my initial post...

On thinking about it, I've actually got my initial description a bit confused (although it doesn't affect the problem at hand). I did actually have it in a scroll view when setting the transparency in IB (but with scrollers hidden). At other times, I just had it as an NSView with custom subclass of NSTextView. Doesn't make much difference to my problem, as I've tried it both ways and had the same problem.

But I think, as posted above, "setDrawsBackground:" may be what I'm after, rather than tranparency a such (haven't had a chance to try it yet). I'll have a fiddle with this, when I get a chance.
     
   
 
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
Top
Privacy Policy
All times are GMT -4. The time now is 07:33 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,