Re: NSTableView and NSArrayController with "Handles Content As Compound Value" - won't select new items in Table View
Re: NSTableView and NSArrayController with "Handles Content As Compound Value" - won't select new items in Table View
- Subject: Re: NSTableView and NSArrayController with "Handles Content As Compound Value" - won't select new items in Table View
- From: Keary Suska <email@hidden>
- Date: Sun, 17 Feb 2013 07:36:28 -0700
On Feb 12, 2013, at 11:26 PM, Alex Rainchik wrote:
> Hello,
>
> I have a typical NSTableView and NSArrayController confguration, with Array
> Controller's Content Array bound to NSMutableArray called "usersArray"
>
> What I'm trying to do is to have an KVO observer setup, so every time
> usersArray is changed I dump it to NSUsersDefault as a way to store it for
> the
> future use.
>
> What I found out is that if I do not select "Handles Content As Compound
> Value"
> option in Content Array binding - my observer is called when objects are
> added
> or deleted in Table View, but not when they are modified.
>
> If I enable "Handles Content As Compound Value" - everything works fine,
> with
> the exception of new objects in Table View are not getting selected on
> insertion. Is there a way to fix that? I'm adding new objects in Table View
> by
> linking "Add" button to add: method in Array Controller.
>
> I've tried binding Array Controller's Content Array directly to Shared Users
> Defaults with exactly the same results - have to enable "Handles Content As
> Compound Value" option and that breaks highlighting/selecting newly inserted
> object in Table View.
This seems to be an issue with NSArrayController. The easiest way around it seems to me to use your own method for -add: and not rely on the NSArrayController behavior.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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