Re: Re: Binding multiple NSTableView and NSPopupButton to an NSArrayControler
Re: Re: Binding multiple NSTableView and NSPopupButton to an NSArrayControler
- Subject: Re: Re: Binding multiple NSTableView and NSPopupButton to an NSArrayControler
- From: email@hidden
- Date: Mon, 02 May 2011 19:47:53 +0000
On May 2, 2011 12:03pm, Quincey Morris <email@hidden> wrote:
On May 2, 2011, at 08:02, Lorenzo Thurman wrote:
> I have an NSPopupButton whose content is bound to an
NSArrayController's (controller A) arrangeObjects controller Key. This
NSArrayController is bound to an NSMutableArray which holds the items for
display. The contents of the NSPopuButton display as expected.
>
> In another XIB (NSWindowController subclass), I have an NSTableView
whose only column's value is bound to an NSArrayController's (controller
B) arrangedObjects. This NSArrayController resides in the same XIB as the
NSTableView and is bound via an NSObject proxy in that same XIB to the
same NSMutableArray as controller A. These items display as expected in
the NSTableView. I can remove an item from the NSTableView, and in the
debugger, I can see that the item is indeed removed from the
NSMutableArray. But when I save the array on quitting the application, I
see the removed item has somehow made it back into the array.
This is a little bit clearer, but still to vague to be of much use.
The short answer is that it sounds like you have 2 mutable arrays
underlying all of this. After you've checked the item removal in the
debugger, you should check in the debugger again at save time that it's
the *same* array you're saving, rather than a duplicate that hasn't had
the item removed.
I have no idea what "bound via an NSObject proxy in that same XIB to the
same NSMutableArray as controller A" means. I'm also not sure, when you
say "bound", you are always referring to an actual binding, or sometimes
to an outlet connection.
To solve this, we need to to know all of the bindings, including (for
each one): the object that's bound from; its location (in nib or created
programmatically); the binding name; the object that it's bound to; *its*
location; the property key that its bound to.
There's only one array. If I set a breakpoint after the item has been
removed and then in gdb: po (NSArray*)[mycontroller arrangedObjects] . The
removed item is not in the array. If during archiving, I do the same, the
removed item is back. The same occurs if I inspect the array directly in
gdb.
All bindings are setup in IB. Here's the rundown:
NSPopupButton
Content
Bind To: itemController
Controller Key: arrangedObjects
itemController
Content Array
Bind To: MyAppsClass
Controller Key: myMutableArray
In a seperate XIB:
NSTableViewColumn
Value
Bind To: anotherItemController
Controller Key: arrangedObjects
anotherItemController
Content Array
Bind to: MyAppsClass (added an NSObject from palette and set its class to
MyAppsClass)
Controller Key: myMutableArray
_______________________________________________
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