Re: How does the NSArrayController selection get set by a view?
Re: How does the NSArrayController selection get set by a view?
- Subject: Re: How does the NSArrayController selection get set by a view?
- From: Chad Woolf <email@hidden>
- Date: Mon, 12 Dec 2005 13:41:36 -0500
It's good to know this way works, and I seem to have no problems with
it. I guess it's just a matter of curiosity on how the NSTableView
can set the selection of an NSArrayController without this explicit
binding. Usually I just bind a table column to a value in the array
controller and that is all. When I change rows on the table it
magically changes the array controller's selection. I wonder if
they're pulling some stunt like checking to see if the binding is
going to an NSArrayController instance and just assuming you want the
selectionIndexes binding too...
Chad
On Dec 12, 2005, at 11:58 AM, Kaspar Fischer wrote:
On 09.12.2005, at 21:14, Chad Woolf wrote:
I am implementing a custom view, and I want to allow my view's
selection to be reflected back to the NSArrayController, like when
selecting rows on an NSTableView. I can do this by binding the
controller's "selectionIndex" to my view's "selectionIndex" (that
is what I called my binding which changes when the user selects
something different, like the selectionIndexes on an NSTableView).
That's how I have done it, too.
This works fine, but I don't have to explicitly set this binding
in the Interface Builder so I think I'm missing something
important on how the controllers are supposed to work, or the IB
is making this binding implicitly and not making that obvious.
IB does not create this binding implicitly. When you load
the custom view, you should bind its "selectionIndex" to the
controller.
Have a look at mmalc's "Graphics Bindings" example at
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
The custom view is called GraphicsView there (see
GraphicsView.m) and the manual binding is done in
MyDocument.m, line 38.
Regards,
Kaspar
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden