Re: NSArrayController Frustration
Re: NSArrayController Frustration
- Subject: Re: NSArrayController Frustration
- From: David Carlisle <email@hidden>
- Date: Sat, 24 Nov 2007 19:53:40 -0700
I'll pose a possible answer to my own question.
I probably need to alloc and init both docArray and docArrayController
at the same time and do all addObject and removeObject operations for
docArray through docArrayController. Then when I open the
corresponding NSWindowController, I would pass in the
docArrayController and bind the NSTableView to it manually, unbinding
it from the TableView when I close the window. That would allow the
docArrayController to tell the TableView to update whenever there was
a change to docArray.
I would still need to be sure the TableView was updated every time
isDocumentEdited changed for any document in docArray, perhaps using a
NSValueTransformer to change the BOOL of isDocumentEdited into an "X"
for a column of the TableView. This is my first venture into Cocoa
Bindings, so I'm not sure if a change in isDocumentEdited within a
changing docArray can be observed.
There may also be a problem if I have one thread doing an addObject to
docArray while another thread is binding or unbinding the TableView,
but I expect i could solve that by putting addObject and bind (or
attach window) under the same NSLock.
On Nov 24, 2007, at 6:58 PM, David Carlisle wrote:
I have an NSMutableArray called docArray which is bound with
Interface Builder to an NSArrayController (Content Array (File's
Owner.docArray)) to which is bound an NSTableView. The File's
owner is a subclass of NSWindowController. I am expecting that when
I do [docArray addObject:x] that the array controller will observe
the change and do a reloadData on the NSTableView. That isn't
happening.
I can't just use addObject: from the array controller, because the
NSWindowController and its window, etc, will not always be open, and
docArray doesn't reside within the NSWindowController.
What do I need to do here?
_______________________________________________
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
_______________________________________________
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