Hi all,

Sorry. I'm just too tired to be programming right now. The solution to my 
earlier question is to send the action to my document controller instead of 
sending it to the NSArrayController. My document controller's action method 
calls NSArrayController's newObject, does its additional processing, and then 
calls NSArrayController's addObject. For future reference, when you think of 
subclassing framework classes, that's a sign that it's time for bed. :)

Thanks,
Soong



----- Original Message ----
From: Oftenwrong Soong <oftenwrongso...@yahoo.com>
To: cocoa-dev@lists.apple.com
Sent: Tue, November 10, 2009 7:26:45 PM
Subject: NSArrayController question

Hi all,

I have a very common UI layout: a Master/Detail view. The Master is a 
NSTableView bound via a NSArrayController to a NSMutableArray, with buttons for 
Add and Remove whose Target/Action is the NSArrayController's add and remove 
actions. The Detail box displays attributes of the NSArrayController's current 
selection. Like I said, a pretty common setup.

I want to intercept the "add" action to fill in default information for the 
newly added item. I can't do this in the model's initializer because each 
item's default information will be computed based on all the prior information 
in the NSMutableArray. It belongs in the controller and not in the model. Is 
this an appropriate time to subclass NSArrayController? Is there a more elegant 
way to do it? Most of what I have read about subclassing says that you 
shouldn't do it. :)

Thanks,
Soong



      
_______________________________________________

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/oftenwrongsoong%40yahoo.com

This email sent to oftenwrongso...@yahoo.com



      
_______________________________________________

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