Re: observeValueForKeyPath and how to do it right
Re: observeValueForKeyPath and how to do it right
- Subject: Re: observeValueForKeyPath and how to do it right
- From: Ken Thomases <email@hidden>
- Date: Mon, 22 Dec 2008 23:05:02 -0600
On Dec 22, 2008, at 10:19 PM, Chris Idou wrote:
--- On Mon, 22/12/08, Ken Thomases <email@hidden> wrote:
On Dec 22, 2008, at 8:19 PM, Chris Idou wrote:
I've got a NSTableView controlled by a NSArrayController using
content set binding. One of the columns is a checkbox, and I need
to take some action when the user changes the value, but I don't
want to put the code in the actual object, because it would be
beyond the concerns of this object to deal with all that.
So what is the right way to go about this?
Sometimes the old ways are best.
Use target-action. Control drag from the cell to your
controller and hook it up to an action method.
How do I then find out which object was clicked?
The argument passed to the action method will be the table view. You
can invoke -clickedRow on it to figure out what row's checkbox was
clicked. Then, you can use that to index into the array controller's
arrangedObjects.
Regards,
Ken
_______________________________________________
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