Re: Strange behaviour with NSTableView binded to NSArrayController with NSSet as content
Re: Strange behaviour with NSTableView binded to NSArrayController with NSSet as content
- Subject: Re: Strange behaviour with NSTableView binded to NSArrayController with NSSet as content
- From: Kyle Sluder <email@hidden>
- Date: Tue, 27 Oct 2009 21:29:48 -0700
On Tue, Oct 27, 2009 at 11:27 AM, Christian Ziegler
<email@hidden> wrote:
> I got an NSTableView binded to an NSArrayController (Values, Sort
> Descriptors, Selection), which itself is binded to a class' NSMutableSet via
> the ContentSet binding. The NSTableView is filled via Drag & Drop or
> File/Open. For an initial insertion of data I set a sortDescriptor, but if
> the user drags objects around in the NSTableView I remove the
> sortDescriptors of the NSTableView by setting it to nil.
The fact that you have a sort descriptor set means the following will
result in an NSArray being created somewhere. There's all sorts of
magic (fast set proxies, slow set proxies, array proxies) that KVO
presents based on what you're observing. I believe your code is
starting out on the array path, but adding more things with no sort
descriptor set triggers a change notification on your model object
that KVO notices and therefore moves everything to the fast path,
which provides no order information at all. NSTableView's binding
support might notice this and not bother trying to reorder things, or
it could try and KVO just silently drops the ball.
Without the AppKit source it's hard to know exactly what's going on,
but the conclusion is "You're Doing It Wrong." You're arbitrarily
switching between having a concept of ordering and no concept of
ordering. You need to always present an ordered collection to your
table view so that you can respect its desire to move things around.
--Kyle Sluder
_______________________________________________
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