Re: Binding NSDictionary in NSArray into table view cell

2013-04-16 Thread Quincey Morris
On Apr 16, 2013, at 10:26 , Chris Paveglio chris_paveg...@yahoo.com wrote:

 I've added an NSArrayController to the xib. Set it's contentArray binding to 
 my array. Then I selected a text box in my table cell where one of the 
 dictionary values would go. I set it's binding to BindTo:arrayController; 
 controllerKey:arrangedObjects; modelKeyPath:{key for the object in 
 dictionary}. 

Yeah, this isn't going to work. It binds each row's text box to the *entire* 
arrangedObjects array, which is not what you want.

If I understand your purpose, you need the Full Monty view binding procedure 
described (if that's the right word for it) here:


https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TableView/PopulatingViewTablesWithBindings/PopulatingView-TablesWithBindings.html

Basically, there are two parts to this:

1. You must explicitly bind the table view's content binding to 
arrangedObjects. Note that this normally isn't done explicitly for cell-based 
table views, but it's necessary in the view-based case.

That causes the table view to set the objectValue property of each 
NSTableCellView to the correct object in arrangedObjects -- one of your 
dictionaries, in your scenario.

2. You must bind the NSTableCellView subviews to the table cell item in the 
binding popup, and use key paths of the form objectValue.key. That should 
give you access to the value for key in the dictionary represented by 
objectValue.

FWIW, I've never actually done part 1 of this myself -- I've used a data source 
for every cell-based table view I've created -- but I've done part 2 several 
times and it's straightforward once you get your head around the objectValue 
concept.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Binding NSDictionary in NSArray into table view cell

2013-04-16 Thread Quincey Morris
On Apr 16, 2013, at 11:41 , Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 for every cell-based table view I've created

every *view*-based table view, I meant.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com