• 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: NSArrayController + NSTableView addObject ends editing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController + NSTableView addObject ends editing


  • Subject: Re: NSArrayController + NSTableView addObject ends editing
  • From: Trygve Inda <email@hidden>
  • Date: Tue, 24 Dec 2013 11:15:16 -0800
  • Thread-topic: NSArrayController + NSTableView addObject ends editing

> This is not because you are adding a row per se, but because the action is
> changing the first responder. If you don't want to allow changing the first
> responder you will need to subclass (the table view, cell, or window) to
> refuse to resign first responder status under the desired conditions.



I subclassed NSTableView but (BOOL)textShouldEndEditing:(NSText *)textObject
Is never called.



In my table delegate I implement:

- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText
*)fieldEditor
{
    if ([[fieldEditor string] length] == 0)
        return NO;    // don't allow empty names
    else
        return YES;
}

This works when editing a cell in a table row when I press return

If I change this to:

- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText
*)fieldEditor
{
        return NO;
}

And start an edit session, if addObject is called on the ArrayCOntroller
feeding the tableView, the cell edit session ends without this method ever
being called.

However: - (void)controlTextDidEndEditing:(NSNotification *)obj

IS called.

How can I prevent the edit session from ending when adding items to the
array controller feeding the table view?


Note that if I



_______________________________________________

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


  • Follow-Ups:
    • Re: NSArrayController + NSTableView addObject ends editing
      • From: Trygve Inda <email@hidden>
  • Prev by Date: Re: NSArrayController + NSTableView addObject ends editing
  • Next by Date: Re: NSArrayController + NSTableView addObject ends editing
  • Previous by thread: Re: NSArrayController + NSTableView addObject ends editing
  • Next by thread: Re: NSArrayController + NSTableView addObject ends editing
  • Index(es):
    • Date
    • Thread