On Aug 20, 2012, at 21:32 , Erik Stainsby <erik.stain...@roaringsky.ca> wrote:

> Okay so that is working fine, but isn't that a venal sin in Cocoa programming?

-- You can connect an action directly to any object that implements the action. 
It doesn't have to be a responder.

-- You could have connected the action to First Responder anyway. The action 
responder chain includes delegates of windows and the application, even though 
they're not responders. Window controllers only get a shot at responding to 
such an action because [if] they're the window's delegate. The app delegate is 
always in the action responder chain.

-- You could have implemented the action method in *both* the window 
controllers. It wasn't necessary to implement the method in an object common to 
both chains. The action would then have gone to whichever window controller's 
window was in the current responder chain (i.e. whichever window controller's 
window was active).

Note that there would be a small difference doing it this way -- the menu item 
would be automatically disabled if neither window was active. By putting the 
action method in the app delegate, it will always be active, unless you add 
code to the app delegate's user interface item validation to disable the action 
conditionally.


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to