NSCollectionView / NSArrayController binding issues
NSCollectionView / NSArrayController binding issues
- Subject: NSCollectionView / NSArrayController binding issues
- From: "Stephen F. Booth" <email@hidden>
- Date: Wed, 20 Feb 2008 10:17:42 -0800
I'm having some problems getting NSCollectionView working in my app
and I'm not sure what else to try! I'm using an NSOperationQueue to
run one or more operations concurrently, and I want to display
information on the progress of these tasks (and allow their
cancellation) to the user. Conceptually what I'm trying to do is
similar to Mail.app's Mail Activity pane.
I've created an NSArrayController and bound its contentArray to the
"operations" key of the NSOperationQueue. If I then create an
NSTableView for displaying the operations in the queue, everything
works as expected- I can add, remove, and cancel operations and the
NSTableView automatically updates appropriately. However, if I create
an NSCollectionView and bind the collection view's content to the
arrangedObjects key of the very same array controller, things do not
work correctly. When I add operations to the queue the
NSCollectionView updates appropriately. However, when an operation
finishes (and is automatically removed from the queue) the completed
operation is still displayed in the NSCollectionView. I find this odd
because the NSTableView is automatically updated when an operation
completes, and the content for both the NSTableView and
NSCollectionView are bound to the same NSArrayController.
I've verified that the correct KVO notifications are sent by
NSOperationQueue by observing the operations key path, so I don't
believe the problem is there. I've also tried programmatic binding
vs. binding in IB, and binding directly to the NSOperationQueue's
operations key (instead of the NSArrayController), neither of which
make a difference. The only way I've gotten NSCollectionView to work
as expected was by binding its content directly to an instance of
NSMutableArray, and then mutating the array by sending messages to the
object returned by mutableArrayValueForKey:. Unfortunately since I'm
using NSOperationQueue I can't manage my own array in this case.
Have I overlooked something?
Stephen
_______________________________________________
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