Why are my images in my NSTableView faded out?
Asked Answered
S

2

8

To start, there's an NSArrayController ("Servers") whose content is an array of "server" objects.

I also have an NSTableView with a column. The column is bound to Server's "arrangedObjects.status" property.

I use a custom NSValueConverter to make that status into an image for the column's dataCell which is an NSImageCell.

What I don't understand is why the images that show up in the column are correct, but consistently faded out. Just to test, I have the same image outside the table view for comparison and it draws fine. The colors in the images are not semi-transparent.

Does the NSImageCell draw the images as faded? Is there something I can configure in IB that will draw them fully saturated?

Samuelsamuela answered 30/12, 2009 at 7:18 Comment(0)
S
17

From Jim Correia on Cocoa-Dev:

"On 10.6, NSImageView will draw its content as dimmed when the control is disabled.

Your binding has “Conditionally Sets Enabled” turned on."

Samuelsamuela answered 23/1, 2010 at 19:5 Comment(1)
I had the same problem but thanks to you I have resolved. Thank you!Skewness
A
1

You might have the image view cell or column's "enabled" property set to NO (or unchecked in IB). I believe this fades the displayed image.

Abcoulomb answered 30/12, 2009 at 12:22 Comment(4)
Hmmm... The "enabled" property for the image cell is definitely checked as is the "enabled" property for the table itself. There is no enabled property for the table columns. The enabled properties are not bound to anything as well. But, by doing a pixel comparison, the images definitely are drawing as if they were disabled.Samuelsamuela
Pure guess: it could be the use of the value converter (NSImageViewCell could be forcibly disabled by the bindings mechanism if it doesn't know how to "set" a new image). You should be able to provide it with the raw data of the image without any conversion.Abcoulomb
Figured it out. This seems really weird to me, but setting the NSImageCell's border attribute to "None" means that it draws the image translucently. Why it does this, I have no idea.Samuelsamuela
Now I think it has something to do with bindings. I can drag an image in just fine and that has no border. When I then take that image instance and bind it, it suddenly turns translucent.Samuelsamuela

© 2022 - 2024 — McMap. All rights reserved.