Well, I've tried just about everything I can think of at this point, but can't change the NSTableView cell successfully. To give some more detail, the cell text is red when there is an error, but when the user goes to edit the cell, I want to change the cell text back to black.

I can change the cell text from red to black when the user first begins to edit the text, with the following code:

-(void)controlTextDidBeginEditing:(NSNotification *)notification
{
    fieldEd = [[notification userInfo] objectForKey:@"NSFieldEditor"];
// Change the field editor text color to black (since it is being edited)
        [fieldEd setTextColor:[NSColor blackColor]];
}

But this only works when the user hits a key. What I would like to do is change the text from red to black when the user enters the cell for editing, but before the user hits any key.

I think what I need is a "controlTextMightBeginEditing" instead of "controlTextDidBeginEditing". ;-)

Any ideas?  Thanks in advance.

On 2-Mar-09, at 8:11 AM, K.Darcy Otto wrote:

I want to change the contents of an NSTableView cell immediately prior to editing, but cannot figure out how to do this. That is, I want to return YES to tableView:aTableView:shouldEditTableColumn:row:, to permit editing to begin, but before editing actually begins, modify the colour and text of the cell that is going to be edited.

I was thinking about putting the code into tableView:aTableView:shouldEditTableColumn:row:; but I'm pretty sure this would not be good form; and in any case, that method is called more than once at the beginning of an edit. Any help would be greatly appreciated.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/dotto%40csusb.edu

This email sent to do...@csusb.edu

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to