Re: Set up an editable view based NSTableView programmatically - how to?
Re: Set up an editable view based NSTableView programmatically - how to?
- Subject: Re: Set up an editable view based NSTableView programmatically - how to?
- From: Quincey Morris <email@hidden>
- Date: Tue, 07 Jan 2014 15:08:18 -0800
On Jan 7, 2014, at 14:27 , Peter <email@hidden> wrote:
> OK, thanks for the pointers. This confirms my suspicion that (a) there is no simple way to do it (as in cell based tables) and (b) that view based tables, despite some obvious advantages, are not to be considered to be the Holy Grail of Table Making - as Apple wants to make us believe.
So, how are the elements of your cell view getting their values? Bindings?
If so, they’re (presumably) bound *to* or *via* the cell view’s “objectValue” property. Therefore, if the element is editable, when its value changes it’s going to invoke a setter on the bound data-model object. Therefore, that object needs to *have* a setter. That setter should be invoked at the value change without your having to do anything.
If bindings aren’t connecting view elements all the way to data model properties, then you’ll a little extra code to write — either to provide the “missing” KVO compliant mutable properties, or to “intercept” the values being set. This may involve adding properties/behavior to your “objectValue” objects, or possibly subclassing NSTableCellView.
I can’t give you a more specific answer than than, because the details will depend on exactly what you are modify, but does that generic explanation throw any light on your problem?
> BTW: The delegate methods I had intended to use in my outline above turned all out to be disabled for view based table views.
I recommend you go directly to the NSTableView.h header file comments for definitive statements about what is called for what kind of views. The information is scattered throughout the file, so it’s difficult to read, but that’s the definitive and correct source for this information.
_______________________________________________
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