On Jun 28, 2008, at 12:43 PM, Stuart Malin wrote:

I have a button in the GUI that should cause various changes to the person selected in the table. In the method that is the target of the button's action, I need to get the selected Person object so I can operate on it.

I know I could use the -selection method of the NSController to get a proxy object, and then use -valueForKey: and -setValueForKey to operate on the object via the proxy. However, this puts the logic of the manipulations in my appController. I'd rather the collection of manipulations be in the Person class, (i.e., have instance methods in the Person class that update a person object).

If I do this (have the update logic in the Person class), then I can't use the proxy object returned by the -selection method of the NSController (because the proxy object doesn't respond to the methods of the backing class).

Have you considered binding the button's target to the array controller's selection, and putting the action methods on the Person directly? (You might need to use a model key path of "self" to get around the proxy-ness.)

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