Re: cell-based NSTableView, NSArrayController and first responder
Re: cell-based NSTableView, NSArrayController and first responder
- Subject: Re: cell-based NSTableView, NSArrayController and first responder
- From: Ken Thomases <email@hidden>
- Date: Wed, 12 Jul 2017 07:32:20 -0500
On Jul 12, 2017, at 4:52 AM, Martin Hewitson <email@hidden> wrote:
>
> I have a new bug in an application which I believe has only appeared in 10.12.
>
> I have a cell-based NSTableView backed by an NSArrayController, and the (new)
> problem I have is that the editing of a cell ends after the first keystroke.
> It looks as if first responder is resigned, but I can’t figure out why, and
> as I say, this seems to be new behaviour.
If you focus the cell again and type, does editing end after _every_ keystroke?
Or can you continue editing properly after that?
Where does focus go? Is the table view focused? Or is nothing in the window
focused? For example, if you type an up- or down-arrow key, does it select
rows in the table view?
> Has anyone else hit this issue and solved it? Or does anyone have any
> pointers where to start digging? I reviewed all the bindings and tableview
> setup, but I haven’t changed anything here in years.
Is the array controller set to rearrange its contents automatically based on
sort descriptors? Does the table column's value binding have Continuously
Updates Value enabled? If so and you change that, does the problem go away?
The table view will be the text cell's delegate and will be called for the
delegate methods described in the NSControlTextEditingDelegate protocol as well
as those described in NSControl. Try using a custom subclass of NSTableView
(if you're not already) and overriding -controlTextDidEndEditing: and
-control:textShouldEndEditing: to log [NSThread callStackSymbols] and call
through to super (if the static superclass's instances respond to those
methods, i.e. [NSTableView instancesRespondToSelector:_cmd]). The stack trace
should give you some idea of what's responsible for removing focus from the
cell.
If the whole table view is losing focus, you could do the same with
-resignFirstResponder.
Try to reproduce the problem in a new project, adding/changing as little as
possible to get it to reproduce. If you can, try sharing that with us.
Regards,
Ken
_______________________________________________
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