On Sep 2, 2011, at 19:01 , Trygve Inda wrote:

> I have an array of objects (of class MyObject) managed by an
> NSArrayController and displayed in an NSTable (via bindings).
> 
> One property of MyObject is a BOOL "marked".
> 
> I need to be notified whenever the user toggles a "marked" checkbox in my
> NSTable.
> 
> What is the best way to do this? Do I need to add an observer to every
> object in the array (there are about 8,000 of them).
> 
> How can I best achieve this so that I get passed the changed MyObject
> (immediately after it changes).

Briefly, you can configure the checkbox cell (either in IB or programmatically) 
to have an action, and possibly an explicit target. In the action method, you 
can use NSTableView's 'clickedRow' method to find the row and hence the object 
whose "marked" property changed, and send a message representing to the change 
directly to whatever object has to be notified.


_______________________________________________

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