On Aug 1, 2008, at 6:53 PM, Revant Jain wrote:

Now my Question was that when I double click on a cell in NSTableView to edit it what method does it call in the MyDocument class(if any) to reflect
the edit onto the particular Person object?

If it does not call a method in MyDocument class how does it change the instance variables of the particular Person object being edited? Does each cell of the NSTableView have reference to its respective Person Object and
it just uses an accessor?

The exact sequence is an implementation detail. Roughly, it invokes something like

[theArrayController setValue:theNewValue forKeyPath:@"selection.personName"] (or .expectedRaise)

The array controller turns that into a call like

[[theMyDocumentInstance objectInEmployeesAtIndex:indexOfSelectedObject] setValue:theNewValue forKeyPath:@"personName"]

From there, KVC does it's usual job, which is typically to invoke the setter (setPersonName:) on your Person object, if that accessor is available.

Cheers,
Ken
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to