Re: Table selection and bindings
Re: Table selection and bindings
- Subject: Re: Table selection and bindings
- From: Steve Mills <email@hidden>
- Date: Tue, 14 Feb 2017 16:41:59 +0000 (GMT)
On Feb 14, 2017, at 09:38 AM, John Brownie <email@hidden> wrote:
I have an NSTableView in a document window, and a utility window which
functions as an inspector, so its content is bound to the selected
object in the table in the document window. Everything seems fine, but
there is a place which doesn't function as I expect.
In the inspector, I can change the display name of the object, which
makes the table drop its selection, so that nothing is selected any
more. All OK, but the tableViewSelectionDidChange: delegate method isn't
called in this instance. In a way, I can see that it's not the user
changing the selection, but the problem becomes that now the inspector
is still pointed at an object, but there's no selection, and the logic
goes badly wrong.
Am I doing things incorrectly, or is there something that I can do to
ensure that the change to the underlying array shown by the table
triggers a selection change?
Do you have an NSArrayController in the mix somewhere? I think the usual way to hook this up is to bind to an NSArrayController, Controller Key "selection". It's kinda hard to offer much more help without knowing your exact setup. You mention using bindings, but also mention the tableViewSelectionDidChange method. Either you connect everything with bindings and it works automatically, or you look for changes via the delegate and reflect them in your inspector manually.
Sent from iCloud's ridiculous UI, so, sorry about the formatting
_______________________________________________
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