On Sep 10, 2009, at 09:40, BareFeet wrote:

Hi Florijan,

I've made an NSActionCell subclass for indicating the priority of an object, similar to the rating column in iTunes. The visual aspects of it are working fine, as well as displaying the correct priority for table rows that have a priority value set.

The problem is setting the new priority when the user clicks on the column. I've tried two approaches:

1) Setting the target of the cell to self, and in the action message set the objectValue of the cell to the desired priority (which I have no problem determining from the location of the mouse click). Somehow that does not affect the bound NSManagedObject at all.

If I understand you correctly, you have bound your table column to an array controller, and are trying to change the data by changing the table column. As far as I understand bindings (which isn't much), you aren't supposed to (because it won't work) change the data by programmatically adjusting the view (ie the table column cell).

This makes sense, though it is unfortunate. I was hoping to somehow be able to do it this way so that virtually all of the logic would be encapsulated in my cell class, without the need for it to know much about objects outside of it.

I suppose the other example that I found of this type of a table column cell was not used with bindings, and consequently this approach worked...

You should instead direct any programmatic changes to the data itself, through the controller in a key-value compliant way. Then the view will automatically reflect those changes.

I hope this helps. If ou need more detail, I'll try to follow up.

I am able to do this. I am not sure it is flawless, but it works as far as I have tested it. I am not too happy about it as it scatters the logic a bit, but it works.

Thanks for your help,
F
_______________________________________________

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