On Sep 2, 2011, at 9:52 PM, Quincey Morris wrote:

> TBH, I'm not sure I understand the question exactly. We might need an example 
> of the sort of objects you're dealing with.
> 
> However, I think you're laboring under a misapprehension. The object values 
> which are displayed in a table view *are* immutable. If they weren't, it 
> wouldn't be possible to use NSNumber objects as cell values, for example. 
> You're never "editing" the *object* that represents the cell value, you're 
> "editing" the cell by replacing the value object with a different value 
> object.

I'm well aware of all of that. 


I explicitly stated the object is immutable because it is very possible to 
supply a mutable object as the object value of a custom cell and modify the 
object value's properties from within the cell. Doing that is very 
straightforward.


What is not straightforward is if the object value is immutable, how I'm 
supposed to have the new immutable object in the cell actually update the 
property of an object in the array controller the table column is bound to. 


An array controller is managing a bunch of Foo objects, each Foo has a bar 
property. There's a table view, with a column, where the column is bound to the 
array controller's arrangedObjects.bar. The table column has a custom BarCell 
which displays and edits Bar objects. 

With the binding setup, the BarCell can easily display the bar values as is, 
but after the user interacts with the cell if there's a new Bar value created, 
how do you actually have it update the bar property in the corresponding Foo 
object? 


The scenario is analogous to a custom text field cell where the cell is 
displaying and editing an immutable NSString. With NSTextFieldCell when you 
edit the text, the table view and cell cooperate to update value at the other 
end of the binding. How do you do that same kind of thing with your own custom 
objects.  I'm pretty sure I could solve it by slopping a bunch of glue into the 
table view and/or delegate, but that's messy. It seems to me there's a single 
simple missing step which would make a custom cell completely support bindings 
when in a table column. NSCell has a value binding and I'm surprised it's not 
already being used here.


--
Seth Willits



_______________________________________________

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

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

Reply via email to