• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Changing NSTableView cell immediately before editing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing NSTableView cell immediately before editing


  • Subject: Re: Changing NSTableView cell immediately before editing
  • From: Corbin Dunn <email@hidden>
  • Date: Tue, 03 Mar 2009 16:48:13 -0800


On Mar 3, 2009, at 7:32 AM, K. Darcy Otto wrote:

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.

One way to do this is to override -fieldEditor:forObject: on the window and return a custom field editor that has the colors you want, when it is your tableView as the object.


corbin


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >Changing NSTableView cell immediately before editing (From: K.Darcy Otto <email@hidden>)
 >Re: Changing NSTableView cell immediately before editing (From: "K. Darcy Otto" <email@hidden>)

  • Prev by Date: Re: fieldEditor not scrolling to keep insertion point / indicator visible
  • Next by Date: binding to number of selected rows in a table
  • Previous by thread: Re: Changing NSTableView cell immediately before editing [solved?]
  • Next by thread: How to create a simple pop-up-menu
  • Index(es):
    • Date
    • Thread