Friday, December 15, 2017

#1 2010-09-28 10:23:20 pm

evocomps
Member
From:: Oklahoma
Registered: 2007-10-15
Posts: 119
Website

NSTableView text color

Is there a way to change the color of the text in a cell in a tableview? I can't find any info on this in the docs. Only setBackgroundColor which doesn't really help.

My app allows you to toggle an item on or off, green text if on, red text if off. I would just use an image cell and swap images but every time I place the cell in the column in IB and build and run, I get a SIGABRT so I figured I'd go back to the text color and ask around.

Thanks

Offline

 

#2 2010-09-29 02:34:57 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5199

Re: NSTableView text color

You can bind the text color to an NSColor.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#3 2010-09-30 02:33:09 pm

evocomps
Member
From:: Oklahoma
Registered: 2007-10-15
Posts: 119
Website

Re: NSTableView text color

Hmm...I don't guess I understand how to do that. How do I bind text colors?

Offline

 

#4 2010-09-30 06:28:14 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5199

Re: NSTableView text color

You need a column in your data that holds an NSColor. Then you just bind the table column's Font Color to it in the Bindings panel.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#5 2016-09-08 01:49:40 am

Chrismacteam
Member
From:: France
Registered: 2010-09-27
Posts: 54
Website

Re: NSTableView text color

Hi
I have exactly the same problem. So if i understood well all topics i found. I have to :
declare : property parent : class "NSColor"
In the list which will populate my table view, i must had a property color and bind it to the array controller.

But i didn't arrive to do that.

For the moment, i use Shane method

Applescript:


set tempList to {}
repeat with i from 1 to count of theNames
set end of tempList to {theName:item i of theNames, theSize:item i of theSizes, isVisible:item i of isVisibles, chemin: item i of chemins}
end repeat

Thanks


Infographiste Freelance Packaging

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)