NSTextField doesnt change textColor

Joined
Oct 1, 2010
Messages
7
Reaction score
0
Points
1
Hi.

I need change the text color of a NSTextField with method setTextColor: (NSColor*) color. But at GUI doesnt change it, internally does it but isnt visibility.
[[myTextField cell] setTextColor:[colorWellSource color]];
[myTextField updateCell: [myTextField cell]];


If anybody can help, ill be grateful. Thx
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Perhaps in your first line you should not be using [myTextField cell], but rather just myTextField. The setTextColor is not part of the NSControl class which is where the cell is coming from.

You might also have to say YES to setAllowsEditingTextAttributes:.

And if the updateCell: call isn't working, then perhaps try setNeedsDisplay:. I'd start by just commenting out that line.
 
OP
V
Joined
Oct 1, 2010
Messages
7
Reaction score
0
Points
1
Thx.

I tried from NSTextField class with just setTextColor and later display but isnt work.

I tried with NSCell cuz is the class whi has the setTextColor method...but nothing works...

Any other idea?? ANyway thx man
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
I was just playing around with this. I found I had to get the connections just right in Interface Builder. In my case, I associated the text outlet my delegate object and then the instructions worked.
 
OP
V
Joined
Oct 1, 2010
Messages
7
Reaction score
0
Points
1
In this case i dont have an IBOutlet associated, cuz its an grafical editor and i get the objects throught and IBAction (id) sender..
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Sounds like you need to do some debugging. Start with proving the sender and the myTextField are non nil and are the same object.
 
OP
V
Joined
Oct 1, 2010
Messages
7
Reaction score
0
Points
1
Isnt nill cuz y loggin
NSLog(@"Color of Selected: %@",[myTextFiled colorText]);
and says the color with alpha and everything... and i asiggn it to the ColorWell and does good...
[colorWellSorce setColor: [myTextField colorText]];
and color well changes color propertly, but never the textField.
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Not seeing the entire code makes it difficult to help. Good luck.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top